8000 Merge pull request #25798 from ksunden/xyticks_arraylike · matplotlib/matplotlib@315dc21 · GitHub
[go: up one dir, main page]

Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 315dc21

Browse files
authored
Merge pull request #25798 from ksunden/xyticks_arraylike
[DOC/TYP]: Allow any array like for set_[xy]ticks, not just list of float
2 parents 89452ce + e48eb53 commit 315dc21

File tree

6 files changed

+12
-9
lines changed

6 files changed

+12
-9
lines changed

lib/matplotlib/axes/_base.pyi

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -399,7 +399,7 @@ class _AxesBase(martist.Artist):
399399
def get_xticks(self, *, minor: bool = ...) -> np.ndarray: ...
400400
def set_xticks(
401401
self,
402-
ticks: Iterable[float],
402+
ticks: ArrayLike,
403403
labels: Iterable[str] | None = ...,
404404
*,
405405
minor: bool = ...,
@@ -424,7 +424,7 @@ class _AxesBase(martist.Artist):
424424
def get_yticks(self, *, minor: bool = ...) -> np.ndarray: ...
425425
def set_yticks(
426426
self,
427-
ticks: Iterable[float],
427+
ticks: ArrayLike,
428428
labels: Iterable[str] | None = ...,
429429
*,
430430
minor: bool = ...,

lib/matplotlib/axes/_secondary_axes.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ class SecondaryAxis(_AxesBase):
2828
) -> None: ...
2929
def set_ticks(
3030
self,
31-
ticks: Iterable[float],
31+
ticks: ArrayLike,
3232
labels: Iterable[str] | None = ...,
3333
*,
3434
minor: bool = ...,

lib/matplotlib/axis.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2009,10 +2009,12 @@ def set_ticks(self, ticks, labels=None, *, minor=False, **kwargs):
20092009
20102010
Parameters
20112011
----------
2012-
ticks : list of floats
2013-
List of tick locations. The axis `.Locator` is replaced by a
2012+
ticks : 1D ArrayLike
2013+
Array of tick locations. The axis `.Locator` is replaced by a
20142014
`~.ticker.FixedLocator`.
20152015
2016+
The values may be either floats or in axis units.
2017+
20162018
Some tick formatters will not label arbitrary tick positions;
20172019
e.g. log formatters only label decade ticks by default. In
20182020
such a case you can set a formatter explicitly on the axis

lib/matplotlib/axis.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ class Axis(martist.Artist):
225225
) -> list[Text]: ...
226226
def set_ticks(
227227
self,
228-
ticks: Iterable[float],
228+
ticks: ArrayLike,
229229
labels: Iterable[str] | None = ...,
230230
*,
231231
minor: bool = ...,

lib/matplotlib/colorbar.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -260,6 +260,7 @@ class Colorbar:
260260
drawedges : bool
261261
Whether to draw lines at color boundaries.
262262
263+
263264
%(_colormap_kw_doc)s
264265
265266
location : None or {'left', 'right', 'top', 'bottom'}
@@ -863,7 +864,7 @@ def set_ticks(self, ticks, *, labels=None, minor=False, **kwargs):
863864
864865
Parameters
865866
----------
866-
ticks : list of floats
867+
ticks : 1D array-like
867868
List of tick locations.
868869
labels : list of str, optional
869870
List of tick labels. If not set, the labels show the data value.

lib/matplotlib/pyplot.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1893,7 +1893,7 @@ def ylim(*args, **kwargs) -> tuple[float, float]:
18931893

18941894

18951895
def xticks(
1896-
ticks: Sequence[float] | None = None,
1896+
ticks: ArrayLike | None = None,
18971897
labels: Sequence[str] | None = None,
18981898
*,
18991899
minor: bool = False,
@@ -1963,7 +1963,7 @@ def xticks(
19631963

19641964

19651965
def yticks(
1966-
ticks: Sequence[float] | None = None,
1966+
ticks: ArrayLike | None = None,
19671967
labels: Sequence[str] | None = None,
19681968
*,
19691969
minor: bool = False,

0 commit comments

Comments
 (0)
0