7
$\begingroup$

I want to plot a surface z=f[x,y] with Plot3D. This time I want to suppress the shading. I just want the mesh on the surface.

Setting ColorFunction -> Function[{x, y, z}, White] there is still some gray in this plot.

How can I suppress the shading altogether?

$\endgroup$
  • $\begingroup$ Possible duplicate: mathematica.stackexchange.com/questions/22562/… $\endgroup$ – Michael E2 May 3 '17 at 12:33
  • $\begingroup$ I think you should at least rephrase your question. As we already know you meant something different than people understood. Additionally your accepted answer not only has not shading, it is only a mesh... Which is something different then shade less white surface. $\endgroup$ – Kuba May 4 '17 at 7:02
7
$\begingroup$

In:

shading = Array[None &, {2, 2}]; (*{{None, None}, {None, None}}*)
Plot3D[Sin[x + y], {x, -Pi, Pi}, {y, -Pi, Pi}, MeshShading -> shading]

Out:

enter image description here

$\endgroup$
  • $\begingroup$ Thank you, this is exactly what I was after. $\endgroup$ – Adalbert Hanßen May 3 '17 at 12:09
  • 3
    $\begingroup$ @AdalbertHanßen since this is what you are after, isn't PlotStyle -> None enough? $\endgroup$ – Kuba May 3 '17 at 12:13
  • $\begingroup$ @AdalbertHanßen Re Kuba's remark: On the face of it, the question is how to color the surface with no shading, not how to have no surface at al. (An alternative way, but not as good as PlotStyle -> None, is ColorFunction -> (Opacity[0] &), which is a way to adapt your original approach.) $\endgroup$ – Michael E2 May 3 '17 at 12:27
  • $\begingroup$ @UnchartedWorks: Plot3D[Sin[x + y], {x, -Pi, Pi}, {y, -Pi, Pi}, MeshShading -> {{None, None}}] does the same. $\endgroup$ – Adalbert Hanßen May 4 '17 at 12:29
  • $\begingroup$ @Kuba: Yes, Plot3D[Sin[x + y], {x, -Pi, Pi}, {y, -Pi, Pi}, PlotStyle -> None] also has the same visual effect. This is the most obvious one and I have to ask myself, why I did not try this one before asking my question, especially since its description clearly points out what it does: "PlotStyle->None specifies that the main objects in a plot should not be drawn explicitly, though mesh and filling are not affected." $\endgroup$ – Adalbert Hanßen May 4 '17 at 17:27
8
$\begingroup$

Another way is to set Ambient lighting on a white surface:

Plot3D[Sin[x] Sin[y], {x, 0, 2 Pi}, {y, 0, 2 Pi}, PlotStyle -> White, 
 Lighting -> {"Ambient", Pink}]

enter image description here

Or plot Pink and White light.

$\endgroup$
  • $\begingroup$ Plot3D[Sin[x] Sin[y], {x, 0, 2 Pi}, {y, 0, 2 Pi}, PlotStyle -> White, Lighting -> {"Ambient", White}] would have been what I was after. I had tried it with PlotStyle->White before, but there remained shadows which were wiped out by your lighting conbditions. How did you get that answer? How would one have to improve the help function of Plot3D such that someone wanting such a skeleton plot arrives at an answer without checking this group? $\endgroup$ – Adalbert Hanßen May 3 '17 at 12:42
  • $\begingroup$ @AdalbertHanßen don't know how to improve documentation but that can be found after scanning options available for Graphics3D and Plot3D. Not easy to find but possible. $\endgroup$ – Kuba May 3 '17 at 12:51
8
$\begingroup$

You need to:

  • Set Glow on the surface. This adds a solid colour component to the shading.

  • Set the other components to Black, to avoid reflecting any light.

This method does not require changing the global lighting, so it will not affect other objects in the scene.

Plot3D[
 Sin[x] Sin[y],
 {x, 0, 2 Pi}, {y, 0, 2 Pi},
 PlotStyle -> Directive[Black, Glow[Pink]]
 ]

enter image description here

$\endgroup$
  • $\begingroup$ PlotStyle -> Directive[Black, Glow[White]] would have been what I was after. How did you get that answer? Glow2 is not described in the help of Plot3D, however it is in the help of PlotStyle. $\endgroup$ – Adalbert Hanßen May 3 '17 at 12:34
  • $\begingroup$ @AdalbertHanßen How you can figure it out: in PlotStyle we can use graphics directives. It is listed on the ref page of graphics directives. (But I do not remember where I saw this for the first time. Probably not on that page. I remembered Glow because I needed the same thing in the past.) $\endgroup$ – Szabolcs May 3 '17 at 14:07
  • $\begingroup$ I looked up for Shading, but I found "As of Version 6.0, Shading has been superseded by ColorFunction." However I should have searched under Plot3D for substrings containing "Shading" to find a reference to MeshShading which is part of UnchartedWorks' solution. - Would it not be nice to have a function which asks for a search pattern (of the current help item) and then scans through all the descriptions of all Options directly or indirectly acessible from the current symbol (in my case: Plot3D) and which returns hyperlinks to all hits of the search pattern - ordered by option or sub-Option? $\endgroup$ – Adalbert Hanßen May 3 '17 at 16:20
  • $\begingroup$ @AdalbertHanßen Did you want only a wireframe (like UnchartedWorks' answer), or a solid surface without gradient shading (like my answer)? $\endgroup$ – Szabolcs May 3 '17 at 16:41
  • $\begingroup$ yes, that's what I was after. Thank you all. $\endgroup$ – Adalbert Hanßen May 4 '17 at 17:32

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.