When plotting functions create graphs, many of the axes properties
that are under automatic control adjust to best display the graph.
These properties adjust automatically when their associated mode property
is set to
auto (which is the default). The following
table lists the axes automatic-mode properties.
When setting any mode property to
What It Controls
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
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
For example, these statements graph two lines:
x = 1:10; y = 1:10; plot(x,y) hold on plot(x,y.^2)
plot statement causes the axes
to change from
This is because
which means the axes recompute the axis limits whenever necessary.
If you assign a value to a property controlled by an automatic-mode
property, MATLAB® sets the mode property to
When the mode property is
manual, the axes does
not automatically recompute the property value.
x = 1:10; y = 1:10; plot(x,y) hold on ax = gca; ax.XLim = [1,10]; ax.YLim = [1,20]; plot(x,y.^2)
Setting values for the
manual. The second
draws a line that is clipped to the axis limits instead of causing
the axes to recompute its limits.