Mathematica Stack Exchange is a question and answer site for users of Mathematica. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

How can I add lines that demarcate the different regions of the following 3D plot:

Plot3D[1/(1 + E^(-a - c)), {a, -8, 8}, {c, -8, 8}]

To give you an idea of what I have in mind I have added the lines and descriptions in the 3D plot in paint; now I want to know how to do it directly in Mathematica.

enter image description here

share|improve this question
Crossposted here – Vitaliy Kaurov Dec 25 '13 at 23:58
up vote 13 down vote accepted

MeshFunctions are generally quite useful for making such demarcations:

With[{d = {Thick, Yellow}},
    Plot3D[1/(1 + E^(-a - c)), {a, -8, 8}, {c, -8, 8}, PlotPoints -> 50, 
        MeshStyle -> {Black, Black, d, d, d}, Mesh -> {10, 10, {0}, {0}, {0}}, 
        MeshFunctions -> {# &, #2 &, # &, If[# <= 0, # + #2] &, If[# <= 0, #2] &}

share|improve this answer
I was working on MeshFunctions too, but couldn't get the function definitions quite right. Didn't know that the If's without second argument could work here. – Sjoerd C. de Vries Dec 26 '13 at 0:06
@SjoerdC.deVries I'm not sure that they do. Try permuting the order of the mesh functions. When one If returns a Null, mesh functions later in the list are messed up. – Michael E2 Dec 26 '13 at 4:13
Thanks for the reply! Sorry for crossposting (I did not anticipate that you would be so quick and effective in replying!) – Guest Dec 26 '13 at 8:14

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.