From 6da96daea6eded2ec06248214f057e7604da9a76 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jouni=20K=2E=20Sepp=C3=A4nen?= Date: Fri, 4 Jul 2025 07:56:49 +0300 Subject: [PATCH 1/4] Backport PR #30237: Add explicit `**options: Any` for `add_subplot` method --- lib/matplotlib/figure.pyi | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/lib/matplotlib/figure.pyi b/lib/matplotlib/figure.pyi index 064503c91384..775d2d24e2a7 100644 --- a/lib/matplotlib/figure.pyi +++ b/lib/matplotlib/figure.pyi @@ -87,17 +87,20 @@ class FigureBase(Artist): # TODO: docstring indicates SubplotSpec a valid arg, but none of the listed signatures appear to be that @overload + def add_subplot(self, *args: Any, projection: Literal["3d"], **kwargs: Any) -> Axes3D: ... + @overload def add_subplot( - self, nrows: int, ncols: int, index: int | tuple[int, int], **kwargs + self, nrows: int, ncols: int, index: int | tuple[int, int], **kwargs: Any ) -> Axes: ... @overload - def add_subplot(self, pos: int, **kwargs) -> Axes: ... + def add_subplot(self, pos: int, **kwargs: Any) -> Axes: ... @overload - def add_subplot(self, ax: Axes, **kwargs) -> Axes: ... + def add_subplot(self, ax: Axes, **kwargs: Any) -> Axes: ... @overload - def add_subplot(self, ax: SubplotSpec, **kwargs) -> Axes: ... + def add_subplot(self, ax: SubplotSpec, **kwargs: Any) -> Axes: ... @overload - def add_subplot(self, **kwargs) -> Axes: ... + def add_subplot(self, **kwargs: Any) -> Axes: ... + @overload def subplots( self, From 534dc2bb485c4befdd8ae610a34248ab67c8459c Mon Sep 17 00:00:00 2001 From: Roman <121314722+GameRoMan@users.noreply.github.com> Date: Fri, 11 Jul 2025 14:30:28 +0100 Subject: [PATCH 2/4] Axes3D --- lib/matplotlib/figure.pyi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/matplotlib/figure.pyi b/lib/matplotlib/figure.pyi index 775d2d24e2a7..84ae1a2b9486 100644 --- a/lib/matplotlib/figure.pyi +++ b/lib/matplotlib/figure.pyi @@ -6,7 +6,7 @@ import numpy as np from numpy.typing import ArrayLike from matplotlib.artist import Artist -from matplotlib.axes import Axes +from matplotlib.axes import Axes, Axes3D from matplotlib.backend_bases import ( FigureCanvasBase, MouseButton, From a863384a7de3f70eb61ef010c343b8f6c679d838 Mon Sep 17 00:00:00 2001 From: Roman <121314722+GameRoMan@users.noreply.github.com> Date: Fri, 11 Jul 2025 14:41:43 +0100 Subject: [PATCH 3/4] axes3d --- lib/matplotlib/figure.pyi | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/matplotlib/figure.pyi b/lib/matplotlib/figure.pyi index 84ae1a2b9486..64dc9d8d41ae 100644 --- a/lib/matplotlib/figure.pyi +++ b/lib/matplotlib/figure.pyi @@ -6,7 +6,8 @@ import numpy as np from numpy.typing import ArrayLike from matplotlib.artist import Artist -from matplotlib.axes import Axes, Axes3D +from matplotlib.axes import Axes +from matplotlib.axes3d import Axes3D from matplotlib.backend_bases import ( FigureCanvasBase, MouseButton, From 4244fb28dbb9c408d2ed586bc0207d4a2ef0a9a0 Mon Sep 17 00:00:00 2001 From: Roman <121314722+GameRoMan@users.noreply.github.com> Date: Sun, 13 Jul 2025 20:29:05 +0100 Subject: [PATCH 4/4] #29341 --- lib/matplotlib/figure.pyi | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/matplotlib/figure.pyi b/lib/matplotlib/figure.pyi index 64dc9d8d41ae..64685ac58dfe 100644 --- a/lib/matplotlib/figure.pyi +++ b/lib/matplotlib/figure.pyi @@ -7,7 +7,6 @@ from numpy.typing import ArrayLike from matplotlib.artist import Artist from matplotlib.axes import Axes -from matplotlib.axes3d import Axes3D from matplotlib.backend_bases import ( FigureCanvasBase, MouseButton, @@ -26,6 +25,8 @@ from matplotlib.lines import Line2D from matplotlib.patches import Rectangle, Patch from matplotlib.text import Text from matplotlib.transforms import Affine2D, Bbox, BboxBase, Transform +from mpl_toolkits.mplot3d import Axes3D + from .typing import ColorType, HashableList _T = TypeVar("_T")