3
$\begingroup$

The code is lent from this and later modified as per need, as shown below:

   Plot3D[Sin[x y], {x, 0, 3}, {y, 0, 3}, PlotTheme -> "Marketing"] /. 
     Thread[{GrayLevel[0, 0.5`], GrayLevel[0, 0.9`], 
        GrayLevel[0, 0.9`]} -> {Opacity[0.01, Green], 
        Opacity[0.01, Green], Opacity[0.9, None]}]

enter image description here

I want only the XY plane in colour and YZ and ZX in white, just as above. However, instead of a single colour XY plane, I am getting an additional black diagonal line joining two corners. How do I remove that and get a single-colour plane instead?

The workaround is to use Epilog and Rectangle below the curve parallel to the XY plane, which I don't want to do.

I want to learn if there is a way to do this without using Epilog by modifying the above code.

Thank you

$\endgroup$

2 Answers 2

3
$\begingroup$

Generate the desired graphics object to be used with the main plot:

floor = Graphics3D[{FaceForm[{Green, Green}], JoinForm["Round"], EdgeForm[None], 
  Polygon[{Scaled[{0, 0, 0}], Scaled[{0, 1, 0}], 
     Scaled[{1, 1, 0}], Scaled[{1, 0, 0}]}]}];

Add the option DisplayFunction -> (Show[#, floor] &) before PlotTheme ->"Marketing" in Plot3D:

Plot3D[Sin[x  y], {x, 0, 3}, {y, 0, 3},
 DisplayFunction -> (Show[#, floor] &), 
 PlotTheme -> "Marketing"]

enter image description here

ParametricPlot3D[{Sin[x], Cos[x], x}, {x, 0, 2  π}, 
 DisplayFunction -> (Show[#, floor] &), PlotTheme -> "Marketing"]

enter image description here

 $Version
"14.0.0 for Linux x86 (64-bit) (December 13, 2023)"
$\endgroup$
2
  • $\begingroup$ It is not working when I use ParametricPlot3D. I am trying to plot this with the modification provided by you. ParametricPlot3D[{Sin[x], Cos[x], x}, {x, 0, 2 \[Pi]}, DisplayFunction -> (Show[#, floor] &), PlotTheme -> "Marketing"]. However it's not working $\endgroup$
    – user444
    Apr 17 at 10:32
  • 1
    $\begingroup$ @user444, I updated with the picture I get using ParametricPlot3D[...]. $\endgroup$
    – kglr
    Apr 17 at 12:08
2
$\begingroup$
p3d = Plot3D[Sin[x  y], {x, 0, 3}, {y, 0, 3}, PlotTheme -> "Marketing"];

vc = Thread[Table[{Green, Opacity[0], Opacity[0]}, 4]];

p3d /. 
 HoldPattern[VertexColors -> _] :> Rule[VertexColors, Last[vc = RotateLeft[vc]]]

enter image description here

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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