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

Skip to content

Clarify that explicit ticklabels are used without further formatting. #26951

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 5, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 12 additions & 12 deletions lib/matplotlib/axis.py
Original file line number Diff line number Diff line change
Expand Up @@ -1961,8 +1961,9 @@ def set_ticklabels(self, labels, *, minor=False, fontdict=None, **kwargs):
----------
labels : sequence of str or of `.Text`\s
Texts for labeling each tick location in the sequence set by
`.Axis.set_ticks`; the number of labels must match the number of
locations.
`.Axis.set_ticks`; the number of labels must match the number of locations.
The labels are used as is, via a `.FixedFormatter` (without further
formatting).

minor : bool
If True, set minor ticks instead of major ticks.
Expand Down Expand Up @@ -2093,26 +2094,25 @@ def set_ticks(self, ticks, labels=None, *, minor=False, **kwargs):
Parameters
----------
ticks : 1D array-like
Array of tick locations. The axis `.Locator` is replaced by a
`~.ticker.FixedLocator`.
Array of tick locations (either floats or in axis units). The axis
`.Locator` is replaced by a `~.ticker.FixedLocator`.

The values may be either floats or in axis units.

Pass an empty list to remove all ticks::

set_ticks([])
Pass an empty list (``set_ticks([])``) to remove all ticks.

Some tick formatters will not label arbitrary tick positions;
e.g. log formatters only label decade ticks by default. In
such a case you can set a formatter explicitly on the axis
using `.Axis.set_major_formatter` or provide formatted
*labels* yourself.

labels : list of str, optional
Tick labels for each location in *ticks*. *labels* must be of the same
length as *ticks*. If not set, the labels are generate using the axis
tick `.Formatter`.
Tick labels for each location in *ticks*; must have the same length as
*ticks*. If set, the labels are used as is, via a `.FixedFormatter`.
If not set, the labels are generated using the axis tick `.Formatter`.

minor : bool, default: False
If ``False``, set the major ticks; if ``True``, the minor ticks.

**kwargs
`.Text` properties for the labels. Using these is only allowed if
you pass *labels*. In other cases, please use `~.Axes.tick_params`.
Expand Down