I am creating many graphs using Plot
, Plot3D
, VectorPlot3D
, etc... I like to toggle my curves, surface and vector fields on and off. I do this with the If
function like so...
Manipulate[
If[a, Plot[Sin[x], {x, -3, 3}],
Plot[, {x, -3, 3}]], {{a, True, "Toggle"}, {True, False}}]
This works fine, except that it requires me to include a blank Plot
as shown when a
is false. Is there a way to do this without having to include a blank plot? I just want the curve to appear and disappear but everything else to remain the same.
This becomes even more of an issue when I am working with options that I want to keep in both values of a
. This can include changes to the axis, plot range, view, etc. The way I'm writing this, I have to retype everything twice for the second blank plot. Is there way to get around this? It seems like there must be an easier way to do this.
@Bob Hanlon - Your suggestion doesn't seem to work. See animated gif below.
Comments
Post a Comment