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

Skip to content

Commit 9cd50a3

Browse files
authored
Merge pull request #26951 from anntzer/tlf
Clarify that explicit ticklabels are used without further formatting.
2 parents c65ce46 + 67878c2 commit 9cd50a3

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

lib/matplotlib/axis.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1961,8 +1961,9 @@ def set_ticklabels(self, labels, *, minor=False, fontdict=None, **kwargs):
19611961
----------
19621962
labels : sequence of str or of `.Text`\s
19631963
Texts for labeling each tick location in the sequence set by
1964-
`.Axis.set_ticks`; the number of labels must match the number of
1965-
locations.
1964+
`.Axis.set_ticks`; the number of labels must match the number of locations.
1965+
The labels are used as is, via a `.FixedFormatter` (without further
1966+
formatting).
19661967
19671968
minor : bool
19681969
If True, set minor ticks instead of major ticks.
@@ -2093,26 +2094,25 @@ def set_ticks(self, ticks, labels=None, *, minor=False, **kwargs):
20932094
Parameters
20942095
----------
20952096
ticks : 1D array-like
2096-
Array of tick locations. The axis `.Locator` is replaced by a
2097-
`~.ticker.FixedLocator`.
2097+
Array of tick locations (either floats or in axis units). The axis
2098+
`.Locator` is replaced by a `~.ticker.FixedLocator`.
20982099
2099-
The values may be either floats or in axis units.
2100-
2101-
Pass an empty list to remove all ticks::
2102-
2103-
set_ticks([])
2100+
Pass an empty list (``set_ticks([])``) to remove all ticks.
21042101
21052102
Some tick formatters will not label arbitrary tick positions;
21062103
e.g. log formatters only label decade ticks by default. In
21072104
such a case you can set a formatter explicitly on the axis
21082105
using `.Axis.set_major_formatter` or provide formatted
21092106
*labels* yourself.
2107+
21102108
labels : list of str, optional
2111-
Tick labels for each location in *ticks*. *labels* must be of the same
2112-
length as *ticks*. If not set, the labels are generate using the axis
2113-
tick `.Formatter`.
2109+
Tick labels for each location in *ticks*; must have the same length as
2110+
*ticks*. If set, the labels are used as is, via a `.FixedFormatter`.
2111+
If not set, the labels are generated using the axis tick `.Formatter`.
2112+
21142113
minor : bool, default: False
21152114
If ``False``, set the major ticks; if ``True``, the minor ticks.
2115+
21162116
**kwargs
21172117
`.Text` properties for the labels. Using these is only allowed if
21182118
you pass *labels*. In other cases, please use `~.Axes.tick_params`.

0 commit comments

Comments
 (0)