pbaspect
Gets or sets the relative lengths of the x, y and z sides of the axes box.
Category: Graphics > Formatting and Annotation
Syntax
pbaspect([rx ry rz])
Sets the plot box aspect ratio of the current axes.
r = pbaspect
Returns the current ratio as a three-element vector.
pbaspect auto
Returns control to the automatic mode, where the box fills the available space.
pbaspect(ax, ___)
Acts on the axes ax.
Description
pbaspect controls the shape of the box that encloses the axes, independently of the data units. pbaspect([1 1 1]) makes a cubic box for 3-D plots and a square one for 2-D plots, whatever the data ranges are.
It differs from daspect, which fixes the ratio of data units per unit of length. Setting pbaspect stores the value in the PlotBoxAspectRatio property and switches the matching mode property to manual.
Input arguments
[rx ry rz]- Three positive numbers. Only their ratios matter.
Output arguments
r- Current aspect ratio, a 1-by-3 vector.
Example
Make the plot box twice as wide as tall
plot(1:10)
pbaspect([2 1 1])
r = pbaspect
Output
r = 1×3
2 1 1