Axes properties control the layout of titles and axis labels within the figure. You can control which dimensions axes can change to accommodate the titles and labels by setting the appropriate properties.
When you create a graph, MATLAB® creates an axes to display
the graph. The axes is sized to fit in the figure and automatically
resizes as you resize the figure. MATLAB applies the automatic
resize behavior only when the axes
Units property is set to
You can control the resize behavior of the axes using the following axes properties:
OuterPosition — Defines
the boundary of the axes including the axis labels, title, and a margin.
For figures with only one axes,
the interior of the figure.
Position — The boundary
of the axes, excluding the tick marks and labels, title, and axis
Specifies whether to use the
OuterPosition or the
as the size to preserve when resizing the figure containing the axes.
TightInset — The margins MATLAB adds
to the width and height of the
to include text labels, title, and axis labels. This property is read
Units — Keep this property
'normalized' to enable automatic axes resizing.
Note: MATLAB changes only the current axes' properties by default. If your plot has multiple axes, MATLAB does not automatically resize any secondary axes.
The following graph shows the areas defined by the
Position expanded by
When you add axis labels and a title, the
to accommodate the additional text.
The size of the rectangle defined by the
includes all graph text. The
As you resize the figure, MATLAB maintains the area defined
that the text is not cut off. Compare the next two graphs, which have
both been resized to the same figure size.
The following figure shows how the default property values apply to 3-D graphs.
When there are multiple axes in a figure use the
prevent titles and labels from being overwritten .
The following figure illustrates how MATLAB resizes the
axes to accommodate the multiline titles on the lower two axes when
'outerposition' reduces the height of the two
upper axes to provide better spacing of the subplots.