@@ -1205,6 +1205,8 @@ def sca(ax: Axes) -> None:
12051205 Set the current Axes to *ax* and the current Figure to the parent of *ax*.
12061206 """
12071207 figure (ax .figure )
1208+ # Mypy sees ax.figure as potentially None,
1209+ # but if you are calling this, it won't be None
12081210 ax .figure .sca (ax ) # type: ignore
12091211
12101212
@@ -1217,7 +1219,7 @@ def cla() -> None:
12171219## More ways of creating axes ##
12181220
12191221@_docstring .dedent_interpd
1220- def subplot (* args , ** kwargs ) -> matplotlib . axes . Axes :
1222+ def subplot (* args , ** kwargs ) -> Axes :
12211223 """
12221224 Add an Axes to the current figure or retrieve an existing Axes.
12231225
@@ -1414,7 +1416,7 @@ def subplots(
14141416 subplot_kw : dict [str , Any ] | None = None ,
14151417 gridspec_kw : dict [str , Any ] | None = None ,
14161418 ** fig_kw
1417- ) -> tuple [Figure , matplotlib . axes . Axes | np .ndarray | SubplotBase ]:
1419+ ) -> tuple [Figure , Axes | np .ndarray | SubplotBase ]:
14181420 """
14191421 Create a figure and a set of subplots.
14201422
@@ -1578,7 +1580,7 @@ def subplot_mosaic(
15781580 gridspec_kw : dict [str , Any ] | None = None ,
15791581 per_subplot_kw : dict [Any , dict [str , Any ]] | None = None ,
15801582 ** fig_kw
1581- ) -> tuple [Figure , dict [Any , matplotlib . axes . Axes ]]:
1583+ ) -> tuple [Figure , dict [Any , Axes ]]:
15821584 """
15831585 Build a layout of Axes based on ASCII art or nested lists.
15841586
@@ -1742,7 +1744,7 @@ def subplot2grid(
17421744 return fig .add_subplot (subplotspec , ** kwargs )
17431745
17441746
1745- def twinx (ax : matplotlib . axes . Axes | None = None ) -> _AxesBase :
1747+ def twinx (ax : Axes | None = None ) -> _AxesBase :
17461748 """
17471749 Make and return a second axes that shares the *x*-axis. The new axes will
17481750 overlay *ax* (or the current axes if *ax* is *None*), and its ticks will be
@@ -1758,7 +1760,7 @@ def twinx(ax: matplotlib.axes.Axes | None = None) -> _AxesBase:
17581760 return ax1
17591761
17601762
1761- def twiny (ax : matplotlib . axes . Axes | None = None ) -> _AxesBase :
1763+ def twiny (ax : Axes | None = None ) -> _AxesBase :
17621764 """
17631765 Make and return a second axes that shares the *y*-axis. The new axes will
17641766 overlay *ax* (or the current axes if *ax* is *None*), and its ticks will be
@@ -2213,8 +2215,8 @@ def _get_pyplot_commands() -> list[str]:
22132215@_copy_docstring_and_deprecators (Figure .colorbar )
22142216def colorbar (
22152217 mappable : ScalarMappable | None = None ,
2216- cax : matplotlib . axes . Axes | None = None ,
2217- ax : matplotlib . axes . Axes | Iterable [matplotlib . axes . Axes ] | None = None ,
2218+ cax : Axes | None = None ,
2219+ ax : Axes | Iterable [Axes ] | None = None ,
22182220 ** kwargs
22192221) -> Colorbar :
22202222 if mappable is None :
0 commit comments