21
$\begingroup$

Mathematica has great plotting capabilities. However, sometimes what is needed is a very basic black and white plot without textures, lighting, glow and other complex features. So, here is my question: what kind of Plot3D options will allow me to get something similar to

$\endgroup$
24
$\begingroup$

I would say you go for the Lighting option:

Plot3D[Exp[-(x^2 + y^2)], {x, -2, 2}, {y, -2, 2}, 
 Lighting -> {{"Ambient", White}}, PlotRange -> All, Mesh -> {20}]

Mathematica graphics

$\endgroup$
  • 1
    $\begingroup$ In fact, Lighting -> {White} is enough. $\endgroup$ – xzczd Apr 3 '13 at 4:54
  • 2
    $\begingroup$ yes, but I wanted to mention explicitly that it's the ambient light which prevents shading. $\endgroup$ – halirutan Apr 3 '13 at 5:01
  • 1
    $\begingroup$ In V10 PlotStyle->White is necessary to deal with an orange plot. One can also add PlotPoints->22, MaxRecursion->0 to obtain really old-school plot :) $\endgroup$ – ybeltukov Sep 7 '14 at 13:11
17
$\begingroup$

Just a few alternatives. (from @Mr.Wizard) If one prefers to have it simple but to keep shading, then

Plot3D[Exp[-(x^2 + y^2)], {x, -2, 2}, {y, -2, 2}, 
 Lighting -> "Neutral", PlotRange -> All, Mesh -> {20}]

enter image description here

Some may want to have transparent mesh

Plot3D[Exp[-(x^2 + y^2)], {x, -2, 2}, {y, -2, 2}, PlotRange -> All, 
 Mesh -> {20}, PlotStyle -> Opacity[0], MeshStyle -> Opacity[.5]]

or from @J.M.

Plot3D[Exp[-(x^2 + y^2)], {x, -2, 2}, {y, -2, 2}, 
 PlotStyle -> FaceForm[None], PlotRange -> All, Mesh -> {20}]

enter image description here

$\endgroup$
  • $\begingroup$ Do you have any thoughts about ColorFunction -> (White &) versus Lighting -> "Neutral"? I typically use the latter. $\endgroup$ – Mr.Wizard Apr 3 '13 at 6:22
  • $\begingroup$ For the second: PlotStyle -> FaceForm[None] works nicely, too. $\endgroup$ – J. M. is away Apr 3 '13 at 7:51
  • $\begingroup$ @Mr.Wizard Lighting -> "Neutral" is more efficient I think - I edited it into my code. Thx ;) $\endgroup$ – Vitaliy Kaurov Apr 3 '13 at 15:52
  • $\begingroup$ @J.M. Yes, nice observation ;) $\endgroup$ – Vitaliy Kaurov Apr 3 '13 at 15:53
  • $\begingroup$ @Mr. Wizard, through close reading of the docs for Plot3D[], it would seem that ColorFunction -> (White &) is entirely equivalent to the default ColorFunction -> Automatic, so one does not really need to tweak ColorFunction for a plain Jane plot... $\endgroup$ – J. M. is away Apr 3 '13 at 16:02
15
$\begingroup$

If one wants a simple wireframe mesh, as in Vitaliy's answer, here's yet another method:

DeleteCases[Plot3D[Exp[-(x^2 + y^2)], {x, -2, 2}, {y, -2, 2}, Mesh -> {20}], _Polygon, ∞]

wireframe plot


As it turns out, however, there is an even simpler way to generate a nice wiremesh:

Plot3D[Exp[-(x^2 + y^2)], {x, -2, 2}, {y, -2, 2}, Mesh -> {20}, PlotStyle -> None]
$\endgroup$
  • 2
    $\begingroup$ There's a certain beauty to this approach. "Polygons, begone!" :-) $\endgroup$ – Mr.Wizard Apr 11 '13 at 12:58
  • $\begingroup$ That's more or less how I read the code, too. :) $\endgroup$ – J. M. is away Apr 11 '13 at 13:20
4
$\begingroup$

Just to mention, for me the accepted answer does not bring the desired result with Mathematica 10. Instead, what I get when running

Plot3D[
  Cos[2 Norm[{x, y}]], {x, 0, 10}, {y, 0, 10},  
  Lighting -> {"Ambient", White},  
  PlotRange -> All, Mesh -> {20}, BoxRatios -> {1, 1, 0.1},  
  Boxed -> False, Axes -> False]

is this:

Orange looking 3d plot

However, a color function did the difference for me:

Plot3D[
  Cos[2 Norm[{x, y}]], {x, 0, 10}, {y, 0, 10},  
  Lighting -> {"Ambient", White}, 
  ColorFunction -> Function[{x, y, z}, White],  
  PlotRange -> All, Mesh -> {20}, BoxRatios -> {1, 1, 0.1}, 
  Boxed -> False, Axes -> False]

enter image description here

$\endgroup$
  • 1
    $\begingroup$ ColorFunction -> (White &) also works. $\endgroup$ – bbgodfrey Mar 6 '18 at 13:51
  • 2
    $\begingroup$ "Just to mention, for me the accepted answer does not bring the desired result with Mathematica 10. " - The default light sources changed in version 10(?), while the answers that came before you were done in version 8. $\endgroup$ – J. M. is away Mar 6 '18 at 14:46
  • $\begingroup$ You should be able to get this with PlotStyle->White too. Might even be faster. $\endgroup$ – b3m2a1 Mar 6 '18 at 17:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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