Graphics Previous page   Next Page

Setting Axis Limits

MATLAB determines the limits automatically for each axis based on the range of the data. You can override the selected limits by specifying the XLim, YLim, or ZLim property. For example, consider a plot of the function evaluated with A = 0.25, alpha = 0.05, and t = 0 to 900.

The plot on the left shows the results. MATLAB selects axis limits that encompass the range of data in both x and y. However, because the plot contains little information beyond t = 100, changing the x-axis limits improves the usefulness of the plot. If the handle of the axes is axes_handle, then the following statement,

creates the plot on the right.

You can use the axis command to set limits on the current axes only.

Semiautomatic Limits

You can specify either the minimum or maximum value for an axis limit and allow the other limit to autorange. Do this by setting an explicit value for the manual limit and Inf for the automatic limit. For example, the statement

sets the XLimMode property to auto and allows MATLAB to determine the maximum value for XLim. Similarly, the statement

sets the XLimMode property to auto and allows MATLAB to determine the minimum value for XLim.


Previous page  Individual Axis Control Setting Tick Mark Locations Next page

© 1994-2005 The MathWorks, Inc.