Graphics |
Targeting Graphics Output with newplot
MATLAB provides the newplot
function to simplify the process of writing graphics M-files that conform to the settings of the NextPlot
properties.
newplot
checks the values of the NextPlot
properties and takes the appropriate action based on these values. You should place newplot
at the beginning of any M-file that calls object creation functions.
When your M-file calls newplot
, the following possible actions occur:
newplot
checks the current figure's NextPlot
property:
newplot
creates one and makes it the current figure.
NextPlot
is add
, newplot
makes the figure the current figure.
NextPlot
is new
, newplot
creates a new figure and makes it the current figure
NextPlot
is replacechildren
, newplot
deletes the figure's children (axes objects and their descendants) and makes this figure the current figure.
NextPlot
is replace
, newplot
deletes the figure's children, resets the figure's properties to the defaults, and makes this figure the current figure.
newplot
checks the current axes' NextPlot
property:
newplot
creates one and makes it the current axes.
NextPlot
is add
, newplot
makes the axes the current axes.
NextPlot
is replacechildren
, newplot
deletes the axes' children and makes this axes the current axes.
NextPlot
is replace
, newplot
deletes the axes' children, resets the axes' properties to the defaults, and makes this axes the current axes.
MATLAB Default Behavior
Consider the default situation where the figure NextPlot
property is add
and the axes NextPlot
property is replace
. When you call newplot
, it
NextPlot
property (which is add
) and determines MATLAB can draw into the current figure with no further action. If there is no current figure, newplot
creates one, but does not recheck its NextPlot
property.
NextPlot
property (which is replace
), deletes all graphics objects from the axes, resets all axes properties (except Position
and Units
) to their defaults, and returns the handle of the current axes.
Preparing Figures and Axes for Graphics | Example -- Using newplot |
© 1994-2005 The MathWorks, Inc.