MATLAB Functions Help Desk

hold

Purpose

Hold current graph in the Figure

Syntax

Description

The hold function determines whether new graphics objects are added to the graph or replace objects in the graph.

hold on retains the current plot and certain Axes properties so that subsequent graphing commands add to the existing graph.

hold off resets Axes properties to their defaults before drawing new plots. hold off is the default.

hold toggles the hold state between adding to the graph and replacing the graph.

Remarks

You test the hold state using the ishold function.

Although the hold state is on, some Axes properties change to accommodate additional graphics objects. For example, the Axes' limits increase when the data requires them to do so.

Algorithm

The hold function sets the NextPlot property of the current Figure and the current Axes. If several Axes objects exist in a Figure window, each Axes has its own hold state. hold also creates an Axes if one does not exist.

hold on sets the NextPlot property of the current Figure and Axes to add.

hold off sets the NextPlot property of the current Axes to replace.

hold toggles the NextPlot property between the add and replace states.

See Also

axis, cla, ishold, newplot

The NextPlot property of Axes and Figure graphics objects.



[ Previous | Help Desk | Next ]