1
1
from collections .abc import Callable , Hashable , Iterable
2
2
import os
3
- from typing import Any , IO , Literal , TypeVar , overload
3
+ from typing import Any , IO , Literal , Sequence , TypeVar , overload
4
4
5
5
import numpy as np
6
6
from numpy .typing import ArrayLike
7
7
8
8
from matplotlib .artist import Artist
9
- from matplotlib .axes import Axes , SubplotBase
9
+ from matplotlib .axes import Axes
10
10
from matplotlib .backend_bases import (
11
11
FigureCanvasBase ,
12
12
MouseButton ,
@@ -92,6 +92,20 @@ class FigureBase(Artist):
92
92
@overload
93
93
def add_subplot (self , ** kwargs ) -> Axes : ...
94
94
@overload
95
+ def subplots (
96
+ self ,
97
+ nrows : Literal [1 ] = ...,
98
+ ncols : Literal [1 ] = ...,
99
+ * ,
100
+ sharex : bool | Literal ["none" , "all" , "row" , "col" ] = ...,
101
+ sharey : bool | Literal ["none" , "all" , "row" , "col" ] = ...,
102
+ squeeze : Literal [True ] = ...,
103
+ width_ratios : Sequence [float ] | None = ...,
104
+ height_ratios : Sequence [float ] | None = ...,
105
+ subplot_kw : dict [str , Any ] | None = ...,
106
+ gridspec_kw : dict [str , Any ] | None = ...,
107
+ ) -> Axes : ...
108
+ @overload
95
109
def subplots (
96
110
self ,
97
111
nrows : int = ...,
@@ -100,11 +114,11 @@ class FigureBase(Artist):
100
114
sharex : bool | Literal ["none" , "all" , "row" , "col" ] = ...,
101
115
sharey : bool | Literal ["none" , "all" , "row" , "col" ] = ...,
102
116
squeeze : Literal [False ],
103
- width_ratios : ArrayLike | None = ...,
104
- height_ratios : ArrayLike | None = ...,
117
+ width_ratios : Sequence [ float ] | None = ...,
118
+ height_ratios : Sequence [ float ] | None = ...,
105
119
subplot_kw : dict [str , Any ] | None = ...,
106
- gridspec_kw : dict [str , Any ] | None = ...
107
- ) -> np .ndarray : ...
120
+ gridspec_kw : dict [str , Any ] | None = ...,
121
+ ) -> np .ndarray : ... # TODO numpy/numpy#24738
108
122
@overload
109
123
def subplots (
110
124
self ,
@@ -114,11 +128,11 @@ class FigureBase(Artist):
114
128
sharex : bool | Literal ["none" , "all" , "row" , "col" ] = ...,
115
129
sharey : bool | Literal ["none" , "all" , "row" , "col" ] = ...,
116
130
squeeze : bool = ...,
117
- width_ratios : ArrayLike | None = ...,
118
- height_ratios : ArrayLike | None = ...,
131
+ width_ratios : Sequence [ float ] | None = ...,
132
+ height_ratios : Sequence [ float ] | None = ...,
119
133
subplot_kw : dict [str , Any ] | None = ...,
120
- gridspec_kw : dict [str , Any ] | None = ...
121
- ) -> np . ndarray | SubplotBase | Axes : ...
134
+ gridspec_kw : dict [str , Any ] | None = ...,
135
+ ) -> Axes | np . ndarray : ...
122
136
def delaxes (self , ax : Axes ) -> None : ...
123
137
def clear (self , keep_observers : bool = ...) -> None : ...
124
138
def clf (self , keep_observers : bool = ...) -> None : ...
0 commit comments