matplotlib
Fork me on GitHub


Travis-CI:

This Page

matplotlib.pyplot.locator_params

matplotlib.pyplot.locator_params(axis='both', tight=None, **kwargs)

Control behavior of tick locators.

Keyword arguments:

axis
[‘x’ | ‘y’ | ‘both’] Axis on which to operate; default is ‘both’.
tight
[True | False | None] Parameter passed to autoscale_view(). Default is None, for no change.

Remaining keyword arguments are passed to directly to the set_params() method.

Typically one might want to reduce the maximum number of ticks and use tight bounds when plotting small subplots, for example:

ax.locator_params(tight=True, nbins=4)

Because the locator is involved in autoscaling, autoscale_view() is called automatically after the parameters are changed.

This presently works only for the MaxNLocator used by default on linear axes, but it may be generalized.