From baad0f4f1a16fa408b283e7bf3d260fb95c510f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Ramos=20Carre=C3=B1o?= Date: Tue, 15 Apr 2025 21:08:17 +0200 Subject: [PATCH 1/2] Allow `None` in set_prop_cycle `set_prop_cycle` allows to pass `None` for resetting the cycle, but with the current type hints, type checkers give an error for this case. --- lib/matplotlib/axes/_base.pyi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/matplotlib/axes/_base.pyi b/lib/matplotlib/axes/_base.pyi index 5be0f1592168..4933d0d1e236 100644 --- a/lib/matplotlib/axes/_base.pyi +++ b/lib/matplotlib/axes/_base.pyi @@ -182,7 +182,7 @@ class _AxesBase(martist.Artist): def get_facecolor(self) -> ColorType: ... def set_facecolor(self, color: ColorType | None) -> None: ... @overload - def set_prop_cycle(self, cycler: Cycler) -> None: ... + def set_prop_cycle(self, cycler: Cycler | None) -> None: ... @overload def set_prop_cycle(self, label: str, values: Iterable[Any]) -> None: ... @overload From 418c5728784e343fde26aedecde3a592d823e14f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Ramos=20Carre=C3=B1o?= Date: Wed, 16 Apr 2025 08:36:13 +0200 Subject: [PATCH 2/2] Add `None` to `set_prop_cycle` docstring Add `None` to the docstring as a request from the maintainers. --- lib/matplotlib/axes/_base.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/matplotlib/axes/_base.py b/lib/matplotlib/axes/_base.py index c5c525b29a06..5a74845df147 100644 --- a/lib/matplotlib/axes/_base.py +++ b/lib/matplotlib/axes/_base.py @@ -1600,7 +1600,7 @@ def set_prop_cycle(self, *args, **kwargs): Parameters ---------- - cycler : `~cycler.Cycler` + cycler : `~cycler.Cycler` or ``None`` Set the given Cycler. *None* resets to the cycle defined by the current style.