ishold

Tells whether the current axes keep existing plots when new ones are added.

Category: Graphics > Graphics Objects

Syntax

tf = ishold

Returns the hold state of the current axes.

tf = ishold(ax)

Returns the hold state of the axes ax.

Description

hold on makes the next plot add to the axes; hold off makes it replace what is there. ishold reads that state, which is useful in functions that draw on caller-supplied axes and want to restore the original state when done.

Input arguments

ax
Optional axes handle.

Output arguments

tf
true if hold is on, otherwise false.

Example

Toggle hold

figure
disp(ishold)
hold on
disp(ishold)
hold off
disp(ishold)
Output
   0
   1
   0

See also

hold newplot plot gca