Graphics |

When you create a graph, MATLAB automatically creates an axes to display the graph. The axes is sized to fit in the figure and automatically resizes as you resize the figure. Note, however, that MATLAB applies the automatic resize behavior only when the axes `Units`

property is set to `normalized`

(the default).

You can control the resize behavior of the axes using the following axes properties.

`OuterPosition`

-- The boundary of the axes including the axis labels, title, and a margin. For figures with only one axes, this is the interior of the figure.`Position`

-- The boundary of the axes, excluding the tick marks and labels, title, and axis labels.`ActivePositionProperty`

-- Specifies whether to use the`OuterPosition`

or the`Position`

property as the size to preserve when resizing the figure containing the axes.`TightInset`

-- The margins added to the width and height of the`Position`

property to include text labels, title, and axis labels.`Units`

-- Keep this property set to`normalized`

to enable automatic axes resizing.

The following graph shows the areas defined by the `OuterPosition`

, `TightInset + Position`

, and `Position`

properties.

When you add axis labels and a title, the `TightInset`

changes to accommodate the additional text, as shown in the following graph.

Now the size of the rectangle defined by the `TightInset`

+ `Position`

properties includes all graph text. The `Position`

and `OuterPosition`

properties remain unchanged.

**Using OuterPosition as the ActivePositionProperty**

As you resize the figure, MATLAB maintains the area defined by the `TightInset`

+ `Position`

so the test is not cut off. Compare the next two graphs, which have both been resized to the same figure size.

**ActivePositionProperty = OuterPosition
**

ActivePositionProperty = Position

The following picture shows how these properties apply to 3-D graphs.

**Axes Resizing in Subplots**

Using the `OuterPosition`

property as the `ActivePositionProperty`

is an effective way to prevent titles and labels from being overwritten when there are multiple axes in a figure.

The following picture illustrates how MATLAB resizes the axes to accommodate the multiline titles on the lower two axes.

The default 3-D view is azimuth = -37.5°, elevation = 30°.

Positioning Axes | Multiple Axes per Figure |

© 1994-2005 The MathWorks, Inc.