pbaspect
Control relative lengths of each axis in the plot box.
📝 Syntax
pbaspect(ratio)
pb = pbaspect()
pbaspect('auto')
pbaspect('manual')
m = pbaspect('mode')
pbaspect(ax, ...)
📥 Input argument
ratio -
Three-element vector of positive values specifying the relative lengths of the x, y, and z axes in the plot box.
'auto' -
Set the plot box aspect ratio mode to automatic.
'manual' -
Set the plot box aspect ratio mode to manual.
'mode' -
Query the current plot box aspect ratio mode ('auto' or 'manual').
ax -
Target axes object. If not specified, uses current axes.
📤 Output argument
pb -
Three-element vector representing the current plot box aspect ratio.
m -
Current plot box aspect ratio mode: 'auto' or 'manual'.
📄 Description
pbaspect controls the relative lengths of the x, y, and z axes in the plot box.
pbaspect(ratio) sets the plot box aspect ratio for the current axes. ratio is a three-element vector of positive values. For example, [3 1 1] means the x-axis is three times as long as the y- and z-axes.
pb = pbaspect() returns the current plot box aspect ratio as a three-element vector.
pbaspect('auto') sets the plot box aspect ratio mode to automatic, enabling the axes to choose the ratio.
pbaspect('manual') sets the mode to manual and uses the ratio stored in the axes.
m = pbaspect('mode') returns the current mode, either 'auto' or 'manual'.
pbaspect(ax, ...) operates on the axes specified by ax instead of the current axes.
Setting the plot box aspect ratio disables the stretch-to-fill behavior of the axes.
💡 Examples
Use equal axis lengths
Use different axis lengths
Revert back to default plot box aspect ratio
Query plot box aspect ratio
Set plot box aspect ratio for specific axes object
🔗 See also
daspect, axis, xlim, ylim, zlim.
🕔 History
1.16.0
initial version
Last updated
Was this helpful?