Graphics |
Disable Automatic Modes
Graphics objects have properties that control many aspects of their behavior and appearance. The axes object in particular has many mode properties that enables it to respond to changes in the data represented in a graph.
For example, when you plot data, the axes determines appropriate axis limits, tick-mark placement, and labeling. Any changes you make to the plotted data (adding another line graph, for example) causes the axes to recompute the axis limits and to determine what values to use for the tick marks.
Fixing Axis Limits
The process of recalculating axis limits and the locations of the tick marks along each axis contributes to the time it takes to create a graph. If you are plotting data into the same axes repeatedly, you can improve performance by manually setting some or all of the axis limits, which, in turn, disables axis scaling and tick picking.
For example, suppose you are plotting time series graphs in which you always view a 200 second time interval along the x-axis and your data ranges from -1 to 1. The following statement creates an axes with these limits and, in the process, sets the limit-picking mode to manual. Thereafter, MATLAB does not change the limits or recalculate tick mark locations (as long as you do not call a high-level plotting function like plot
):
Set All Modes to Manual
To maximize the efficiency with which MATLAB can update your graphs, you should disable all automatic operation so that MATLAB does not need to spend time determining if it is even necessary to recalculate a property value. The following steps illustrate this technique:
painters
to take advantage of its line thinning algorithm.
manual
(see table below).
painters
renderer, set the axes DrawMode
property to fast
.
set
command to set mode properties to manual
. See Changing Graph Data Rapidly for an example.
The following table lists the axes mode properties and provides an explanation of what the mode controls.
Mode Property |
What It Controls |
ALimMode |
Transparency limits mode |
|
Positioning of the viewpoint |
|
Positioning of the camera target in the axes |
|
The direction of "up" in 2-D and 3-D views |
|
The size of the projected scene and stretch-to-fit behavior |
|
Mapping of data values to colors |
|
Relative scaling of data units along x-, y-, and z-axes and stretch-to-fit behavior |
DrawMode |
Controls the way MATLAB renders graphics objects (use with line graphs) |
|
Relative scaling of plot box along x-, y-, and z-axes and stretch-to-fit behavior |
|
Direction of axis tick marks (in for 2-D, out for 3-D) |
|
Limits of the respective x, y, and z axes |
|
Tick mark spacing along the respective x-, y-, and z-axes |
|
Tick mark labels along the respective x-, y-, and z-axes |
Optimizing Graphics Performance | Changing Graph Data Rapidly |
© 1994-2005 The MathWorks, Inc.