Let's say I have this plot.

enter image description here

It was produced using two different Plot3D commands combined via Show in order to reduce the opacity of only one of them.

s[p0_] := Sign[Re[p0]] Sign[Im[p0]]

Show[Plot3D[s[rep0 + I imp0], {rep0, -1, 1}, {imp0, -1, 1}], 
 Plot3D[0, {rep0, -1, 1}, {imp0, -1, 1}, 
  PlotStyle -> Directive[Blue, Opacity[0.1]]]]

Obviously, it would have been nicer, to include both graphs in one Plot3D command like so,

Plot3D[{s[rep0 + I imp0],0}, {rep0, -1, 1}, {imp0, -1, 1}]

However, I couldn't figure out how to then apply the opacity setting only to the second graph. Is this possible?


1 Answer 1


You just need to give a list to PlotStyle:

s[p0_] := Sign[Re[p0]] Sign[Im[p0]];
  {s[rep0 + I imp0], 0},
  {rep0, -1, 1},
  {imp0, -1, 1},
  PlotStyle -> {Automatic, Directive[Blue, Opacity[0.1]]}


  • $\begingroup$ That was surprisingly simple. Thanks! $\endgroup$
    – Janosh
    Dec 7, 2016 at 16:13

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