# How to connect a checkbox with part of the graphics?

I'd like to have a checkbox in a Manipulate expression, governing whether part of the graphics is displayed or not. For instance, assume that I have a surface with two planes:

Show[Plot3D[x^2+y^2,{x,-1,1},{y,-1,1},PlotStyle->Opacity[0.5]],
ParametricPlot3D[{0, u, v}, {u, -1, 1}, {v, -1, 1}, PlotStyle -> Opacity[0.5], Mesh -> None],
ParametricPlot3D[{u, 0, v}, {u, -1, 1}, {v, -1, 1}, PlotStyle -> Opacity[0.5], Mesh -> None]]


Now I'd like to wrap it in a Manipulate with two checkboxes, enabling or disabling the planes. Currently, I'm doing something like this:

Manipulate[
Apply[Show,
Join[{Plot3D[...]},
If[xzero, {ParametricPlot3D[{0, u, v}, {u, -1, 1}, {v, -1, 1},
PlotStyle -> Opacity[0.5], Mesh -> None]}, {}],
If[yzero, {ParametricPlot3D[{u, 0, v}, {u, -1, 1}, {v, -1, 1},
PlotStyle -> Opacity[0.5], Mesh -> None]}, {}]]],
{{xzero, True, "x=0"}, {True, False}}, {{yzero, True, "y=0"}, {True,
False}}]


but somehow feel it's overly complicated. What is the right way to do this?

-

Discrete control via opacity:

Manipulate[
Show[Plot3D[x^2 + y^2, {x, -1, 1}, {y, -1, 1},   PlotStyle -> Opacity[0.5]],
ParametricPlot3D[{0, u, v}, {u, -1, 1}, {v, -1, 1},
PlotStyle -> Opacity[xzero], Mesh -> None],
ParametricPlot3D[{u, 0, v}, {u, -1, 1}, {v, -1, 1}, PlotStyle -> Opacity[yzero],
Mesh -> None], AxesLabel -> {X, Y, Z}],
{{xzero, .5, "x=0"}, {0, .5}, Checkbox},
{{yzero, .5, "y=0"}, {0, .5}, Checkbox},ControlPlacement -> Left]


But I usually prefer to control opacity continuously. Then you have more flexible control to "pronounce" one object and "denounce" another, still keeping it. If opacity is set to zero - plane disappear.

Manipulate[
Show[Plot3D[x^2 + y^2, {x, -1, 1}, {y, -1, 1},
PlotStyle -> Opacity[0.5], Mesh -> True, MeshFunctions -> {#3 &},
ColorFunction -> "Rainbow"],
ParametricPlot3D[{0, u, v}, {u, -1, 1}, {v, -1, 1}, PlotStyle ->
Directive[col1, Specularity[White, 30], Opacity[xzero]], Mesh -> None],
ParametricPlot3D[{u, 0, v}, {u, -1, 1}, {v, -1, 1}, PlotStyle ->
Directive[col2, Specularity[White, 30], Opacity[xzero]],
Mesh -> None], AxesLabel -> {X, Y, Z}],
{{xzero, .5, "x=0"}, 0, 1, Slider, ImageSize -> 75},
{{yzero, .5, "y=0"}, 0, 1, Slider, ImageSize -> 75},
{col1, Blue, ImageSize -> Tiny},
{col2, Red, ImageSize -> Tiny},
ControlPlacement -> Left]


-
p1 = ParametricPlot3D[{0, u, v}, {u, -1, 1}, {v, -1, 1},
PlotStyle -> Opacity[0.5], Mesh -> None];
p2 = ParametricPlot3D[{u, 0, v}, {u, -1, 1}, {v, -1, 1},
PlotStyle -> Opacity[0.5], Mesh -> None];

Manipulate[Show[
Plot3D[x x + y y, {x, -1, 1}, {y, -1, 1}],
If[xzero, p1, Sequence @@ {}], If[yzero, p2, Sequence @@ {}]],
{{xzero, True, "x=0"}, {True, False}},
{{yzero, True, "y=0"}, {True, False}}]


-