Note: This page has been translated by MathWorks. Please click here

To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

Set axis limits and aspect ratios

`axis(limits)`

`axis style`

`axis mode`

`axis ydirection`

`axis visibility`

`lim = axis`

```
[m,v,d]
= axis('state')
```

`___ = axis(ax,___)`

`axis `

uses a
predefined style to set the limits and scaling. For example, specify
the style as `style`

`equal`

to use equal data unit lengths
along each axis.

`axis `

sets whether MATLAB`mode`

^{®} automatically
chooses the limits or not. Specify the mode as `manual`

, `auto`

,
or one of the semiautomatic options, such as `'auto x'`

.

`axis `

, where `ydirection`

`ydirection`

is `ij`

,
places the origin at the upper left corner of the axes. The *y* values
increase from top to bottom. The default for `ydirection`

is `xy`

,
which places the origin at the lower left corner. The *y* values
increase from bottom to top.

`axis `

, where `visibility`

`visibility`

is `off`

,
turns off the display of the axes background. Plots in the axes still
display. The default for `visibility`

is `on`

,
which displays the axes background.

returns
the `lim`

= axis*x*-axis and *y*-axis limits
for the current axes. For 3-D axes, it also returns the *z*-axis
limits. For polar axes, it returns the *theta*-axis
and *r*-axis limits.

You can combine multiple input arguments together, for example,

`axis image ij`

. The options are evaluated from left to right. Subsequent options can overwrite properties set by prior ones.If axes do not exist, the

`axis`

function creates them.Use

`hold on`

to keep plotting functions from overriding preset axis limits.

Was this topic helpful?