HOLD Plot Hold Toggle Function
Section: Handle-Based Graphics
UsageToggles the hold state on the currently active plot. The general syntax for its use is
state is either
to turn hold on, or
to turn hold off. If you specify no argument then
hold toggles the state of the hold:
You can also specify a particular axis to the hold command
handle is the handle for a particular axis.
holdfunction allows one to construct a plot sequence incrementally, instead of issuing all of the plots simultaneously using the
ExampleHere is an example of using both the
holdcommand and the multiple-argument
plotcommand to construct a plot composed of three sets of data. The first is a plot of a modulated Gaussian.
--> x = linspace(-5,5,500); --> t = exp(-x.^2); --> y = t.*cos(2*pi*x*3); --> plot(x,y);
We now turn the hold state to
'on', and add another plot
sequence, this time composed of the top and bottom envelopes of
the modulated Gaussian. We add the two envelopes simultaneously
using a single
plot command. The fact that
'on' means that these two envelopes are added to (instead of
replace) the current contents of the plot.
--> plot(x,y); --> hold on --> plot(x,t,'g-',x,-t,'b-')