Graphics Previous page   Next Page

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:

  1. newplot checks the current figure's NextPlot property:
  2. newplot checks the current axes' NextPlot property:

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

  1. Checks the value of the current figure's 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.
  2. Checks the value of the current axes' 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.

Previous page  Preparing Figures and Axes for Graphics Example -- Using newplot Next page

© 1994-2005 The MathWorks, Inc.