daspect

Gets or sets the data aspect ratio of the current axes.

Category: Graphics > Formatting and Annotation

Syntax

daspect([dx dy dz])

Sets the relative length of one data unit along each axis.

r = daspect

Returns the current ratio.

daspect('auto') / daspect('manual')

Lets the axes choose the ratio, or freezes it.

Description

With [1 1 1], one unit looks equally long in x, y and z, which is what axis equal does. With [1 2 1], one unit in y is drawn half as long as one in x. Use it to correct or exaggerate the proportions of a plot.

Input arguments

[dx dy dz]
Three positive numbers. Only their ratios matter.

Output arguments

r
Row vector with the data aspect ratio.

Example

Setting the ratio

plot(1:5)
daspect([1 2 1])
disp(daspect)
Output
     1     2     1

See also

axis pbaspect xlim ylim