# axis

Sets the scaling and range of x, y, and z axes (x by default). Called without arguments, axis turns autoscaling on.

## Syntax

axis()

axis([X_lo X_hi])

axis([X_lo X_hi Y_lo Y_hi])

axis([X_lo X_hi Y_lo Y_hi Z_lo Z_hi])

axis(option)

## Inputs

X_lo, X_hi
Lowest and highest x ranges.
Type: double | integer
Dimension: scalar
Y_lo, Y_hi
Lowest and highest y ranges.
Type: double | integer
Dimension: scalar
Z_lo, Z_hi
Lowest and highest z ranges.
Type: double | integer
Dimension: scalar
option
Takes one of the following values:
'bestfit'
The length of each axis is adjusted to maximize the graphics area (3D plots only).
'cubical'
The length of each axis is the same (3D plots only). This is the default value.
'equal'
Sets uniform aspect ratio to the axes (2D plots only).
'normal'
Resets the aspect ratio (2D plots only).
'on'
Enables the visibility of the axes' ticks and labels.
'off'
Disables the visibility of the axes' ticks and labels.
'square'
Sets square aspect ratio to the axes (2D plots only).
'tight'
Sets the axes range equal to the data limits.
'unscaled'
The length of each axis is based on the axis values (3D plots only).

## Examples

Simple axis example:
clf;
x=linspace(-pi,pi, 100);
plot(x,sin(x));
axis ([-4 4 -1.5 1.5])
axis('equal') example:
clf;
x=linspace(-pi,pi, 100);
plot(x,sin(x));
axis('equal');
axis('square') example:
clf;
x=linspace(-pi,pi, 100);
plot(x,sin(x));
axis('square');
axis('tight') example:
clf;
x=linspace(-pi,pi, 100);
plot(x,sin(x));
axis('tight');

axis('bestfit') example:
clf;
x=[0:0.1:2*pi];
y=x;
z=sin(x')*cos(y);
s=surf(x, y, z)
axis('bestfit');
axis('unscaled') example:
clf;
x=[0:0.1:2*pi];
y=x;
z=sin(x')*cos(y);
s=surf(x, y, z)
axis('unscaled');