You are reading an old version of the documentation (v2.1.2). For the latest version see
Version 2.1.2
Fork me on GitHub


This Page


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.