You are reading documentation for the unreleased version of Matplotlib. Try searching for the released version of this page instead?
Version 3.1.0.post1213+g63d96d286
matplotlib
Fork me on GitHub

Table of Contents

matplotlib.pyplot.axis

matplotlib.pyplot.axis(*args, emit=True, **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)
Parameters:
xmin, xmax, ymin, ymax : float, optional

The axis limits to be set. 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, then disable further autoscaling.
'tight' Set limits just large enough to show all data, then disable further autoscaling.
'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.

Returns:
xmin, xmax, ymin, ymax : float

The axis limits.