3-D Visualization |
Overriding Stretch-to-Fill
To maintain a particular shape, you can specify the size of the axes in absolute units such as inches, which are independent of the figure window size. However, this is not a good approach if you are writing an M-file that you want to work with a figure window of any size. A better approach is to specify the aspect ratio of the axes and override automatic stretch-to-fill.
In cases where you want a specific aspect ratio, you can override stretching by specifying a value for these axes properties:
DataAspectRatio
or DataAspectRatioMode
PlotBoxAspectRatio
or PlotBoxAspectRatioMode
CameraViewAngle
or CameraViewAngleMode
The first two sets of properties affect the aspect ratio directly. Setting either of the mode properties to manual
simply disables stretch-to-fill while maintaining all current property values. In this case, MATLAB enlarges the axes until one dimension of the position rectangle constrains it.
Setting the CameraViewAngle
property disables stretch-to-fill, and also prevents MATLAB from readjusting the size of the axes if you change the view.
Default Aspect Ratio Selection | Effects of Setting Aspect Ratio Properties |
© 1994-2005 The MathWorks, Inc.