matplotlib.pyplot.locator_params#

matplotlib.pyplot.locator_params(axis='both',tight=None,**kwargs)[source]#

Control behavior of major tick locators.

Because the locator is involved in autoscaling,autoscale_viewis called automatically after the parameters are changed.

Parameters:
axis{'both', 'x', 'y'}, default: 'both'

The axis on which to operate. (For 3D Axes,axis can also beset to 'z', and 'both' refers to all three axes.)

tightbool or None, optional

Parameter passed toautoscale_view.Default is None, for no change.

Other Parameters:
**kwargs

Remaining keyword arguments are passed to directly to theset_params() method of the locator. Supported keywords dependon the type of the locator. See for exampleset_params for theticker.MaxNLocatorused by default for linear.

Notes

Examples

When plotting small subplots, one might want to reduce the maximumnumber of ticks and use tight bounds, for example:

ax.locator_params(tight=True,nbins=4)
On this page