Closed
Description
Inspired by #14980 (comment).
Current APIs:
pyplot.xticks(ticks=None, labels=None, **kwargs)
Axes.set_xticks(self, ticks, minor=False)
Axes.set_xticklabels(self, labels, fontdict=None, minor=False, **kwargs)
Notes:
- The
Axes
methods are just thin wrappers around theAxis
methods. - The kwargs are
Text
properties.
Issue
The Axes API feels a bit odd. AFAICS set_xticklabels
does not make much sense without set_xticks
before; otherwise how do I know that the labels will be at the correct places and that I have the right number of labels for the ticks.
Proposal
- Extend the API of
set_xticks
to bemaybe even withAxes.set_xticks(self, ticks, labels=None, minor=False, **kwargs)
ticks=None
to be compatible with the pyplot API - though I don't know if one needs the ability to set ticks without positions. - Soft-deprecate
set_xticklabels
. It's too widely used to be deprecated, but we shouldn't have two equal ways here. - Optionally add the minor kwarg to
pyplot.xticks
; it's not strictly necessary because pyplot may have less functionality than the OOP interface; but it doesn't hurt either.
The proposed signature would be an API-change because the minor argument might have been passed positionally. Thus, we should start with _make_keyword_only
on that parameter.