diff --git a/lib/matplotlib/axes/_base.pyi b/lib/matplotlib/axes/_base.pyi index d5a49bec0e54..3a926ecbffa1 100644 --- a/lib/matplotlib/axes/_base.pyi +++ b/lib/matplotlib/axes/_base.pyi @@ -399,7 +399,7 @@ class _AxesBase(martist.Artist): def get_xticks(self, *, minor: bool = ...) -> np.ndarray: ... def set_xticks( self, - ticks: Iterable[float], + ticks: ArrayLike, labels: Iterable[str] | None = ..., *, minor: bool = ..., @@ -424,7 +424,7 @@ class _AxesBase(martist.Artist): def get_yticks(self, *, minor: bool = ...) -> np.ndarray: ... def set_yticks( self, - ticks: Iterable[float], + ticks: ArrayLike, labels: Iterable[str] | None = ..., *, minor: bool = ..., diff --git a/lib/matplotlib/axes/_secondary_axes.pyi b/lib/matplotlib/axes/_secondary_axes.pyi index 0e1debef003a..c2ae923f16d6 100644 --- a/lib/matplotlib/axes/_secondary_axes.pyi +++ b/lib/matplotlib/axes/_secondary_axes.pyi @@ -28,7 +28,7 @@ class SecondaryAxis(_AxesBase): ) -> None: ... def set_ticks( self, - ticks: Iterable[float], + ticks: ArrayLike, labels: Iterable[str] | None = ..., *, minor: bool = ..., diff --git a/lib/matplotlib/axis.py b/lib/matplotlib/axis.py index eb24ff1fac84..fe066bec21c2 100644 --- a/lib/matplotlib/axis.py +++ b/lib/matplotlib/axis.py @@ -2009,10 +2009,12 @@ def set_ticks(self, ticks, labels=None, *, minor=False, **kwargs): Parameters ---------- - ticks : list of floats - List of tick locations. The axis `.Locator` is replaced by a + ticks : 1D ArrayLike + Array of tick locations. The axis `.Locator` is replaced by a `~.ticker.FixedLocator`. + The values may be either floats or in axis units. + 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 diff --git a/lib/matplotlib/axis.pyi b/lib/matplotlib/axis.pyi index 8361b4b3720e..28b0d0507497 100644 --- a/lib/matplotlib/axis.pyi +++ b/lib/matplotlib/axis.pyi @@ -225,7 +225,7 @@ class Axis(martist.Artist): ) -> list[Text]: ... def set_ticks( self, - ticks: Iterable[float], + ticks: ArrayLike, labels: Iterable[str] | None = ..., *, minor: bool = ..., diff --git a/lib/matplotlib/colorbar.py b/lib/matplotlib/colorbar.py index f3c5eead0540..fb6f1831bb2f 100644 --- a/lib/matplotlib/colorbar.py +++ b/lib/matplotlib/colorbar.py @@ -260,6 +260,7 @@ class Colorbar: drawedges : bool Whether to draw lines at color boundaries. + %(_colormap_kw_doc)s location : None or {'left', 'right', 'top', 'bottom'} @@ -863,7 +864,7 @@ def set_ticks(self, ticks, *, labels=None, minor=False, **kwargs): Parameters ---------- - ticks : list of floats + ticks : 1D array-like List of tick locations. labels : list of str, optional List of tick labels. If not set, the labels show the data value. diff --git a/lib/matplotlib/pyplot.py b/lib/matplotlib/pyplot.py index 27b677195470..71e467e041b3 100644 --- a/lib/matplotlib/pyplot.py +++ b/lib/matplotlib/pyplot.py @@ -1893,7 +1893,7 @@ def ylim(*args, **kwargs) -> tuple[float, float]: def xticks( - ticks: Sequence[float] | None = None, + ticks: ArrayLike | None = None, labels: Sequence[str] | None = None, *, minor: bool = False, @@ -1963,7 +1963,7 @@ def xticks( def yticks( - ticks: Sequence[float] | None = None, + ticks: ArrayLike | None = None, labels: Sequence[str] | None = None, *, minor: bool = False,