Navigation

Operators and Keywords

Function List:

C++ API

: data_aspect_ratio = daspect ()
: daspect (data_aspect_ratio)
: daspect (mode)
: data_aspect_ratio_mode = daspect ("mode")
: daspect (hax, …)

Query or set the data aspect ratio of the current axes.

The aspect ratio is a normalized 3-element vector representing the span of the x, y, and z-axis limits.

daspect (mode)

Set the data aspect ratio mode of the current axes. mode is either "auto" or "manual".

daspect ("mode")

Return the data aspect ratio mode of the current axes.

daspect (hax, …)

Operate on the axes in handle hax instead of the current axes.

See also: axis, pbaspect, xlim, ylim, zlim.

Demonstration 1

The following code

 clf;
 x = 0:0.01:4;
 plot (x,cos(x), x,sin(x));
 axis square;
 daspect ([1 1 1]);
 title ("square plot box with axis limits [0, 4, -2, 2]");

Produces the following figure

Figure 1

Demonstration 2

The following code

 clf;
 x = 0:0.01:4;
 plot (x,cos (x), x,sin (x));
 axis ([0 4 -1 1]);
 daspect ([2 1 1]);
 title ("square plot box with axis limits [0, 4, -1, 1]");

Produces the following figure

Figure 1

Demonstration 3

The following code

 clf;
 x = 0:0.01:4;
 plot (x,cos(x), x,sin(x));
 daspect ([1 2 1]);
 pbaspect ([2 1 1]);
 title ("2x1 plot box with axis limits [0, 4, -2, 2]");

Produces the following figure

Figure 1

Demonstration 4

The following code

 clf;
 x = 0:0.01:4;
 plot (x,cos(x), x, sin(x));
 axis square;
 set (gca, "activepositionproperty", "position");
 daspect ([1 1 1]);
 title ("square plot box with axis limits [0, 4, -2, 2]");

Produces the following figure

Figure 1

Demonstration 5

The following code

 clf;
 x = 0:0.01:4;
 plot (x,cos(x), x,sin(x));
 axis ([0 4 -1 1]);
 set (gca, "activepositionproperty", "position");
 daspect ([2 1 1]);
 title ("square plot box with axis limits [0, 4, -1, 1]");

Produces the following figure

Figure 1

Package: octave