@@ -15,7 +15,7 @@ from matplotlib.colors import Colormap, Normalize
1515from matplotlib .colorbar import Colorbar
1616from matplotlib .cm import ScalarMappable
1717from matplotlib .gridspec import GridSpec , SubplotSpec
18- from matplotlib .image import _ImageBase
18+ from matplotlib .image import _ImageBase , FigureImage
1919from matplotlib .layout_engine import (
2020 ConstrainedLayoutEngine ,
2121 LayoutEngine ,
@@ -69,7 +69,6 @@ class SubplotParams:
6969 ) -> None : ...
7070
7171class FigureBase (Artist ):
72- figure : FigureBase | None
7372 artists : list [Artist ]
7473 lines : list [Line2D ]
7574 patches : list [Patch ]
@@ -154,15 +153,15 @@ class FigureBase(Artist):
154153 * ,
155154 sharex : bool | Literal ["none" , "all" , "row" , "col" ] = ...,
156155 sharey : bool | Literal ["none" , "all" , "row" , "col" ] = ...,
157- squeeze : Literal [ True ] = ...,
156+ squeeze : bool = ...,
158157 width_ratios : ArrayLike | None = ...,
159158 height_ratios : ArrayLike | None = ...,
160159 subplot_kw : dict [str , Any ] | None = ...,
161160 gridspec_kw : dict [str , Any ] | None = ...
162161 ) -> np .ndarray | SubplotBase | Axes : ...
163162 def delaxes (self , ax : Axes ) -> None : ...
164163 def clear (self , keep_observers : bool = ...) -> None : ...
165- def clf (self , keep_observers : bool = ...): ...
164+ def clf (self , keep_observers : bool = ...) -> None : ...
166165
167166 @overload
168167 def legend (self ) -> Legend : ...
@@ -203,7 +202,7 @@ class FigureBase(Artist):
203202 def align_xlabels (self , axs : Iterable [Axes ] | None = ...) -> None : ...
204203 def align_ylabels (self , axs : Iterable [Axes ] | None = ...) -> None : ...
205204 def align_labels (self , axs : Iterable [Axes ] | None = ...) -> None : ...
206- def add_gridspec (self , nrows : int = ..., ncols : int = ..., ** kwargs ): ...
205+ def add_gridspec (self , nrows : int = ..., ncols : int = ..., ** kwargs ) -> GridSpec : ...
207206 @overload
208207 def subfigures (
209208 self ,
@@ -234,7 +233,7 @@ class FigureBase(Artist):
234233 def _gci (self ) -> ScalarMappable | None : ...
235234 def _process_projection_requirements (
236235 self , * args , axes_class = None , polar = False , projection = None , ** kwargs
237- ): ...
236+ ) -> tuple [ type [ Axes ], dict [ str , Any ]] : ...
238237 def get_default_bbox_extra_artists (self ) -> list [Artist ]: ...
239238 def get_tightbbox (
240239 self ,
@@ -258,7 +257,7 @@ class FigureBase(Artist):
258257 ) -> dict [Any , Axes ]: ...
259258
260259class SubFigure (FigureBase ):
261- figure : FigureBase
260+ figure : Figure
262261 subplotpars : SubplotParams
263262 dpi_scale_trans : Affine2D
264263 canvas : FigureCanvasBase
@@ -295,6 +294,7 @@ class SubFigure(FigureBase):
295294 def get_axes (self ) -> list [Axes ]: ...
296295
297296class Figure (FigureBase ):
297+ figure : Figure
298298 bbox_inches : Bbox
299299 dpi_scale_trans : Affine2D
300300 bbox : Bbox
@@ -357,7 +357,7 @@ class Figure(FigureBase):
357357 origin : Literal ["upper" , "lower" ] | None = ...,
358358 resize : bool = ...,
359359 ** kwargs
360- ): ...
360+ ) -> FigureImage : ...
361361 def set_size_inches (
362362 self , w : float | tuple [float , float ], h : float | None = ..., forward : bool = ...
363363 ) -> None : ...
@@ -371,7 +371,7 @@ class Figure(FigureBase):
371371 def clear (self , keep_observers : bool = ...) -> None : ...
372372 def draw_without_rendering (self ) -> None : ...
373373 def draw_artist (self , a : Artist ) -> None : ...
374- def add_axobserver (self , func : Callable [[Figure ], Any ]): ...
374+ def add_axobserver (self , func : Callable [[Figure ], Any ]) -> None : ...
375375 def savefig (
376376 self ,
377377 fname : str | os .PathLike | IO ,
@@ -388,7 +388,7 @@ class Figure(FigureBase):
388388 mouse_pop : MouseButton = ...,
389389 mouse_stop : MouseButton = ...,
390390 ) -> list [tuple [int , int ]]: ...
391- def waitforbuttonpress (self , timeout : float = ...): ...
391+ def waitforbuttonpress (self , timeout : float = ...) -> None | bool : ...
392392 def tight_layout (
393393 self ,
394394 * ,
0 commit comments