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