You are reading documentation for the unreleased version of Matplotlib. Try searching for the released version of this page instead?
Applications are open for the 2018 John Hunter Matplotlib Summer Fellowship. Apply now!
Version 2.2.2.post1772+gd9240e24b
matplotlib
Fork me on GitHub

Table Of Contents

matplotlib.axes.Axes.autoscale_view

Axes.autoscale_view(tight=None, scalex=True, scaley=True)

Autoscale the view limits using the data limits.

You can selectively autoscale only a single axis, e.g., the xaxis by setting scaley to False. The autoscaling preserves any axis direction reversal that has already been done.

If tight is False, the axis major locator will be used to expand the view limits if rcParams['axes.autolimit_mode'] is 'round_numbers'. Note that any margins that are in effect will be applied first, regardless of whether tight is True or False. Specifying tight as True or False saves the setting as a private attribute of the Axes; specifying it as None (the default) applies the previously saved value.

The data limits are not updated automatically when artist data are changed after the artist has been added to an Axes instance. In that case, use matplotlib.axes.Axes.relim() prior to calling autoscale_view.