/Matplotlib 3.1


matplotlib.pyplot.axis(*args, **kwargs) [source]

Convenience method to get or set some axis properties.

Call signatures:

xmin, xmax, ymin, ymax = axis()
xmin, xmax, ymin, ymax = axis([xmin, xmax, ymin, ymax])
xmin, xmax, ymin, ymax = axis(option)
xmin, xmax, ymin, ymax = axis(**kwargs)
xmin, xmax, ymin, ymax : float, optional

The axis limits to be set. Either none or all of the limits must be given. This can also be achieved using

ax.set(xlim=(xmin, xmax), ylim=(ymin, ymax))
option : bool or str

If a bool, turns axis lines and labels on or off. If a string, possible values are:

Value Description
'on' Turn on axis lines and labels. Same as True.
'off' Turn off axis lines and labels. Same as False.
'equal' Set equal scaling (i.e., make circles circular) by changing axis limits.
'scaled' Set equal scaling (i.e., make circles circular) by changing dimensions of the plot box.
'tight' Set limits just large enough to show all data.
'auto' Automatic scaling (fill plot box with data).
'normal' Same as 'auto'; deprecated.
'image' 'scaled' with axis limits equal to data limits.
'square' Square plot; similar to 'scaled', but initially forcing xmax-xmin = ymax-ymin.
emit : bool, optional, default True

Whether observers are notified of the axis limit change. This option is passed on to set_xlim and set_ylim.

xmin, xmax, ymin, ymax : float

The axis limits.

Examples using matplotlib.pyplot.axis

© 2012–2018 Matplotlib Development Team. All rights reserved.
Licensed under the Matplotlib License Agreement.