라이선스가 부여된 사용자만 번역 문서를 볼 수 있습니다. 번역 문서를 보려면 로그인하십시오.


Set or query axes data aspect ratio




The data aspect ratio determines the relative scaling of the data units along the x-, y-, and z-axes.

daspect with no arguments returns the data aspect ratio of the current axes.

daspect([aspect_ratio]) sets the data aspect ratio in the current axes to the specified value. Specify the aspect ratio as three relative values representing the ratio of the x-, y-, and z-axis scaling (e.g., [1 1 3] means one unit in x is equal in length to one unit in y and three units in z).

daspect('mode') returns the current value of the data aspect ratio mode, which can be either auto (the default) or manual. See Tips.

daspect('auto') sets the data aspect ratio mode to auto.

daspect('manual') sets the data aspect ratio mode to manual.

daspect(axes_handle,...) performs the set or query on the axes identified by the first argument, axes_handle. When you do not specify an axes handle, daspect operates on the current axes.


collapse all

Equal Scaling Along Each Axis

Plot the function $z = xe^{(-x^2-y^2)}$ over the range $-2 \leq x \leq 2$ and $-2 \leq y \leq 2$.

[x,y] = meshgrid(-2:.2:2);
z = x.*exp(-x.^2 - y.^2);


Query the data aspect ratio to show the axis scaling.

ans =

     4     4     1

Use equal scaling along each axis by setting the data aspect ratio to [1,1,1].


More About

collapse all


daspect sets or queries values of the axes object DataAspectRatio and DataAspectRatioMode properties.

When the data aspect ratio mode is auto, the data aspect ratio adjusts so that each axis spans the space available in the figure window. If you are displaying a representation of a real-life object, you should set the data aspect ratio to [1 1 1] to produce the correct proportions.

Setting a value for data aspect ratio or setting the data aspect ratio mode to manual disables the MATLAB® stretch-to-fill feature (stretching of the axes to fit the window). This means setting the data aspect ratio to a value, including its current value,


can cause a change in the way the graphs look. See the Stretch-to-Fill section of the axes description for more information.

See Also

| | | |

Introduced before R2006a

Was this topic helpful?