Graphics Previous page   Next Page

Automatic Axes Resize

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.

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°.


Previous page  Positioning Axes Multiple Axes per Figure Next page

© 1994-2005 The MathWorks, Inc.