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
4 Answers
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}]
-
1$\begingroup$ In fact,
Lighting -> {White}
is enough. $\endgroup$– xzczd ♦Commented Apr 3, 2013 at 4:54 -
2$\begingroup$ yes, but I wanted to mention explicitly that it's the ambient light which prevents shading. $\endgroup$ Commented Apr 3, 2013 at 5:01
-
5$\begingroup$ In V10
PlotStyle->White
is necessary to deal with an orange plot. One can also addPlotPoints->22, MaxRecursion->0
to obtain really old-school plot :) $\endgroup$ Commented Sep 7, 2014 at 13:11
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}]
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}]
-
$\begingroup$ Do you have any thoughts about
ColorFunction -> (White &)
versusLighting -> "Neutral"
? I typically use the latter. $\endgroup$ Commented Apr 3, 2013 at 6:22 -
$\begingroup$ For the second:
PlotStyle -> FaceForm[None]
works nicely, too. $\endgroup$ Commented Apr 3, 2013 at 7:51 -
$\begingroup$ @Mr.Wizard
Lighting -> "Neutral"
is more efficient I think - I edited it into my code. Thx ;) $\endgroup$ Commented Apr 3, 2013 at 15:52 -
$\begingroup$ @J.M. Yes, nice observation ;) $\endgroup$ Commented Apr 3, 2013 at 15:53
-
$\begingroup$ @Mr. Wizard, through close reading of the docs for
Plot3D[]
, it would seem thatColorFunction -> (White &)
is entirely equivalent to the defaultColorFunction -> Automatic
, so one does not really need to tweakColorFunction
for a plain Jane plot... $\endgroup$ Commented Apr 3, 2013 at 16:02
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, ∞]
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]
-
2$\begingroup$ There's a certain beauty to this approach. "Polygons, begone!" :-) $\endgroup$ Commented Apr 11, 2013 at 12:58
-
$\begingroup$ That's more or less how I read the code, too. :) $\endgroup$ Commented Apr 11, 2013 at 13:20
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:
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]
-
2$\begingroup$
ColorFunction -> (White &)
also works. $\endgroup$ Commented Mar 6, 2018 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$ Commented Mar 6, 2018 at 14:46
-
1$\begingroup$ You should be able to get this with
PlotStyle->White
too. Might even be faster. $\endgroup$– b3m2a1Commented Mar 6, 2018 at 17:55