Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit af7f6b5

Browse files
meeseeksmachinetimhoffm
authored andcommitted
Backport PR #14019: Update docstring of locator_params() (#14074)
1 parent c1464e9 commit af7f6b5

File tree

1 file changed

+14
-11
lines changed

1 file changed

+14
-11
lines changed

lib/matplotlib/axes/_base.py

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2874,33 +2874,36 @@ def ticklabel_format(self, *, axis='both', style='', scilimits=None,
28742874

28752875
def locator_params(self, axis='both', tight=None, **kwargs):
28762876
"""
2877-
Control behavior of tick locators.
2877+
Control behavior of major tick locators.
2878+
2879+
Because the locator is involved in autoscaling, `~.Axes.autoscale_view`
2880+
is called automatically after the parameters are changed.
28782881
28792882
Parameters
28802883
----------
28812884
axis : {'both', 'x', 'y'}, optional
28822885
The axis on which to operate.
28832886
28842887
tight : bool or None, optional
2885-
Parameter passed to :meth:`autoscale_view`.
2888+
Parameter passed to `~.Axes.autoscale_view`.
28862889
Default is None, for no change.
28872890
28882891
Other Parameters
28892892
----------------
2890-
**kw
2893+
**kwargs
28912894
Remaining keyword arguments are passed to directly to the
2892-
:meth:`~matplotlib.ticker.MaxNLocator.set_params` method.
2895+
``set_params()`` method of the locator. Supported keywords depend
2896+
on the type of the locator. See for example
2897+
`~.ticker.MaxNLocator.set_params` for the `.ticker.MaxNLocator`
2898+
used by default for linear axes.
28932899
2894-
Typically one might want to reduce the maximum number of ticks and use
2895-
tight bounds when plotting small subplots, for example::
2900+
Examples
2901+
--------
2902+
When plotting small subplots, one might want to reduce the maximum
2903+
number of ticks and use tight bounds, for example::
28962904
28972905
ax.locator_params(tight=True, nbins=4)
28982906
2899-
Because the locator is involved in autoscaling, :meth:`autoscale_view`
2900-
is called automatically after the parameters are changed.
2901-
2902-
This presently works only for the `~matplotlib.ticker.MaxNLocator` used
2903-
by default on linear axes, but it may be generalized.
29042907
"""
29052908
_x = axis in ['x', 'both']
29062909
_y = axis in ['y', 'both']

0 commit comments

Comments
 (0)