Skip to content

Commit 3eb471d

Browse files
committed
Improvements to docstring and to API docs.
1 parent da16bce commit 3eb471d

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

doc/api/axis_api.rst

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -226,17 +226,20 @@ Other
226226
Discouraged
227227
-----------
228228

229-
These methods implicitly use `~matplotlib.ticker.FixedLocator` and
230-
`~matplotlib.ticker.FixedFormatter`. They can be convenient, but if
231-
not used together may de-couple your tick labels from your data.
229+
These methods should be used together with care, calling ``set_ticks``
230+
to specify the desired tick locations **before** calling ``set_ticklabels`` to
231+
specify a matching series of labels. Calling ``set_ticks`` makes a
232+
`~matplotlib.ticker.FixedLocator`; it's list of locations is then used by
233+
``set_ticklabels`` to make an appropriate
234+
`~matplotlib.ticker.FuncFormatter`.
232235

233236
.. autosummary::
234237
:toctree: _as_gen
235238
:template: autosummary.rst
236239
:nosignatures:
237240

238-
Axis.set_ticklabels
239241
Axis.set_ticks
242+
Axis.set_ticklabels
240243

241244

242245

lib/matplotlib/axis.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1617,8 +1617,9 @@ def set_ticklabels(self, ticklabels, *, minor=False, **kwargs):
16171617
Parameters
16181618
----------
16191619
ticklabels : sequence of str or of `.Text`\s
1620-
List of texts for tick labels; must include values for non-visible
1621-
labels.
1620+
Texts for labeling each tick location in the sequence set by
1621+
`.Axis.set_ticks`; the number of labels must match the number of
1622+
locations.
16221623
minor : bool
16231624
If True, set minor ticks instead of major ticks.
16241625
**kwargs

0 commit comments

Comments
 (0)