10

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?

Szabolcs
  • 234,956
  • 30
  • 623
  • 1,263
Adalbert Hanßen
  • 2,808
  • 12
  • 26
  • Possible duplicate: https://mathematica.stackexchange.com/questions/22562/how-to-plot-a-3d-surface-with-a-simple-black-and-white-style – Michael E2 May 03 '17 at 12:33
  • 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. – Kuba May 04 '17 at 07:02

3 Answers3

10

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

webcpu
  • 3,182
  • 12
  • 17
  • Thank you, this is exactly what I was after. – Adalbert Hanßen May 03 '17 at 12:09
  • 3
    @AdalbertHanßen since this is what you are after, isn't PlotStyle -> None enough? – Kuba May 03 '17 at 12:13
  • @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.) – Michael E2 May 03 '17 at 12:27
  • @UnchartedWorks: Plot3D[Sin[x + y], {x, -Pi, Pi}, {y, -Pi, Pi}, MeshShading -> {{None, None}}] does the same. – Adalbert Hanßen May 04 '17 at 12:29
  • @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." – Adalbert Hanßen May 04 '17 at 17:27
9

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

Szabolcs
  • 234,956
  • 30
  • 623
  • 1,263
  • 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. – Adalbert Hanßen May 03 '17 at 12:34
  • @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.) – Szabolcs May 03 '17 at 14:07
  • 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? – Adalbert Hanßen May 03 '17 at 16:20
  • @AdalbertHanßen Did you want only a wireframe (like UnchartedWorks' answer), or a solid surface without gradient shading (like my answer)? – Szabolcs May 03 '17 at 16:41
  • yes, that's what I was after. Thank you all. – Adalbert Hanßen May 04 '17 at 17:32
8

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.

Kuba
  • 136,707
  • 13
  • 279
  • 740
  • 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? – Adalbert Hanßen May 03 '17 at 12:42
  • @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. – Kuba May 03 '17 at 12:51