hold
Retain current plot when adding new plots
Description
hold on
sets the axes hold state to on, which retains plots in
the current axes so that new plots added to the axes do not delete existing plots. When
the hold state is on, new plots use the next colors and line styles based on the
ColorOrder
and LineStyleOrder
properties of the
axes. MATLAB® adjusts axes limits, tick marks, and tick labels to display the full range
of data. If an axes object does not exist, then the hold
command
creates one.
hold off
sets the axes hold state to off so that new plots added
to the axes clear existing plots and reset all axes properties. When the hold state is
off, the next plot added to the axes uses the first color and line style based on the
ColorOrder
and LineStyleOrder
properties of the
axes. This option is the default behavior.
hold
toggles the hold state between on and off.
hold(
sets the axes hold state by
specifying a state
)state
value. You can specify state
as
"on"
, "off"
, a logical value, or an
OnOffSwitchState
value.
Examples
Input Arguments
Tips
Use the
ishold
function to test the hold state.
Algorithms
The hold
function sets these properties: