Graphics |
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, = 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, since 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 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
.
Individual Axis Control | Setting Tick Mark Locations |