# matplotlib.axes.Axes.autoscale_view¶

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

Autoscale the view limits using the data limits.

Parameters: tightbool or NoneIf True, only expand the axis limits using the margins. Note that unlike for autoscale, tight=True does not set the margins to zero. If False and rcParams["axes.autolimit_mode"] (default: 'data') is 'round_numbers', then after expansion by the margins, further expand the axis limits using the axis major locator. If None (the default), reuse the value set in the previous call to autoscale_view (the initial value is False, but the default style sets rcParams["axes.autolimit_mode"] (default: 'data') to 'data', in which case this behaves like True). scalexboolWhether to autoscale the x axis (default is True). scaleyboolWhether to autoscale the x axis (default is True).

Notes

The autoscaling preserves any preexisting axis direction reversal.

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.

If the views of the axes are fixed, e.g. via set_xlim, they will not be changed by autoscale_view(). See matplotlib.axes.Axes.autoscale() for an alternative.