Skip to content

Commit 613a8e8

Browse files
committed
[TYP] Fix overload of pyplot.subplots
1 parent 2d1db48 commit 613a8e8

File tree

2 files changed

+31
-0
lines changed

2 files changed

+31
-0
lines changed

lib/matplotlib/figure.pyi

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,20 @@ class FigureBase(Artist):
106106
gridspec_kw: dict[str, Any] | None = ...,
107107
) -> Axes: ...
108108
@overload
109+
def subplots(
110+
self,
111+
nrows: int = ...,
112+
ncols: int = ...,
113+
*,
114+
sharex: bool | Literal["none", "all", "row", "col"] = ...,
115+
sharey: bool | Literal["none", "all", "row", "col"] = ...,
116+
squeeze: Literal[True],
117+
width_ratios: Sequence[float] | None = ...,
118+
height_ratios: Sequence[float] | None = ...,
119+
subplot_kw: dict[str, Any] | None = ...,
120+
gridspec_kw: dict[str, Any] | None = ...,
121+
) -> np.ndarray: ... # TODO numpy/numpy#24738
122+
@overload
109123
def subplots(
110124
self,
111125
nrows: int = ...,

lib/matplotlib/pyplot.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1579,6 +1579,23 @@ def subplots(
15791579
...
15801580

15811581

1582+
@overload
1583+
def subplots(
1584+
nrows: int = ...,
1585+
ncols: int = ...,
1586+
*,
1587+
sharex: bool | Literal["none", "all", "row", "col"] = ...,
1588+
sharey: bool | Literal["none", "all", "row", "col"] = ...,
1589+
squeeze: Literal[True] = ...,
1590+
width_ratios: Sequence[float] | None = ...,
1591+
height_ratios: Sequence[float] | None = ...,
1592+
subplot_kw: dict[str, Any] | None = ...,
1593+
gridspec_kw: dict[str, Any] | None = ...,
1594+
**fig_kw
1595+
) -> tuple[Figure, np.ndarray]: # TODO numpy/numpy#24738
1596+
...
1597+
1598+
15821599
@overload
15831600
def subplots(
15841601
nrows: int = ...,

0 commit comments

Comments
 (0)