Filling FaceGrids of Plot3D, with solid color?
ClearAll[canvas]
canvas[color_: GrayLevel[0, .3]] := Graphics3D@{{EdgeForm[], color, EdgeForm[None],
InfinitePlane[{Scaled[{0, 0, 0}], Scaled[{0, 1, 0}], Scaled[{1, 1, 0}]}],
InfinitePlane[{Scaled[{0, 0, 0}], Scaled[{0, 0, 1}], Scaled[{0, 1, 1}]}],
InfinitePlane[{Scaled[{0, 1, 0}], Scaled[{0, 1, 1}], Scaled[{1, 1, 1}]} ]}}
plot = Plot3D[Sin[x + y^2], {x, -3, 3}, {y, -2, 2},
ColorFunction -> "BlueGreenYellow",
FaceGrids -> {{-1, 0, 0}, {0, 1, 0}, {0, 0, -1}}, Boxed -> False];
Show[plot, canvas[], PlotRange -> All]
Show[plot, canvas[Opacity[.3, Orange]], PlotRange -> All]
plot2 = Plot3D[x + Sin[x/2 + (y/2)^2], {x, 4, 6}, {y, 7, 9},
ColorFunction -> "BlueGreenYellow",
FaceGrids -> {{-1, 0, 0}, {0, 1, 0}, {0, 0, -1}},
Boxed -> False, BoxRatios -> {3, 2, 1}];
Show[plot2, canvas[Opacity[.2, Blue]], PlotRange -> All]
plot = Plot3D[Sin[x + y^2], {x, -3, 3}, {y, -2, 2},
ColorFunction -> "BlueGreenYellow",
PlotTheme -> {"Marketing", "NoAxes"}, Boxed -> False]
We can use SliceContourPlot3D
with "BackPlanes"
as the slice surface to add face grids with desired colors:
ClearAll[addFaceGrids]
addFaceGrids[color_: GrayLevel[.8], linecolor_: White] := Module[{r = PlotRange[#]},
Show[#, SliceContourPlot3D[#, "BackPlanes",
{x, r[[1, 1]], r[[1, 2]]}, {y, r[[2, 1]], r[[2, 2]]}, {z, r[[3, 1]], r[[3, 2]]},
ContourShading -> {color, color}, Contours -> {Automatic, 6},
ContourStyle -> Directive[Thick, linecolor],
BoundaryStyle -> Directive[Thick, linecolor]] & /@ {x, y, z}]] &
Examples:
addFaceGrids[] @ Plot3D[Sin[x + y^2], {x, -3, 3}, {y, -2, 2},
ColorFunction -> "BlueGreenYellow", Boxed -> False]
addFaceGrids[Opacity[.1, Red]] @
Plot3D[Sin[x + y^2], {x, -3, 3}, {y, -2, 2},
ColorFunction -> "BlueGreenYellow", Boxed -> False, BoxRatios -> {3, 2, 1}]
addFaceGrids[Opacity[.1, LightBlue]] @
ParametricPlot3D[{Cos[3 u], Sin[5 u], u/2}, {u, 0, 2 Pi},
PlotStyle -> {Red, Tube[.02]}, ImageSize -> Medium,
Boxed -> False, Lighting -> "Neutral"]