@@ -1205,6 +1205,8 @@ def sca(ax: Axes) -> None:
1205
1205
Set the current Axes to *ax* and the current Figure to the parent of *ax*.
1206
1206
"""
1207
1207
figure (ax .figure )
1208
+ # Mypy sees ax.figure as potentially None,
1209
+ # but if you are calling this, it won't be None
1208
1210
ax .figure .sca (ax ) # type: ignore
1209
1211
1210
1212
@@ -1217,7 +1219,7 @@ def cla() -> None:
1217
1219
## More ways of creating axes ##
1218
1220
1219
1221
@_docstring .dedent_interpd
1220
- def subplot (* args , ** kwargs ) -> matplotlib . axes . Axes :
1222
+ def subplot (* args , ** kwargs ) -> Axes :
1221
1223
"""
1222
1224
Add an Axes to the current figure or retrieve an existing Axes.
1223
1225
@@ -1414,7 +1416,7 @@ def subplots(
1414
1416
subplot_kw : dict [str , Any ] | None = None ,
1415
1417
gridspec_kw : dict [str , Any ] | None = None ,
1416
1418
** fig_kw
1417
- ) -> tuple [Figure , matplotlib . axes . Axes | np .ndarray | SubplotBase ]:
1419
+ ) -> tuple [Figure , Axes | np .ndarray | SubplotBase ]:
1418
1420
"""
1419
1421
Create a figure and a set of subplots.
1420
1422
@@ -1578,7 +1580,7 @@ def subplot_mosaic(
1578
1580
gridspec_kw : dict [str , Any ] | None = None ,
1579
1581
per_subplot_kw : dict [Any , dict [str , Any ]] | None = None ,
1580
1582
** fig_kw
1581
- ) -> tuple [Figure , dict [Any , matplotlib . axes . Axes ]]:
1583
+ ) -> tuple [Figure , dict [Any , Axes ]]:
1582
1584
"""
1583
1585
Build a layout of Axes based on ASCII art or nested lists.
1584
1586
@@ -1742,7 +1744,7 @@ def subplot2grid(
1742
1744
return fig .add_subplot (subplotspec , ** kwargs )
1743
1745
1744
1746
1745
- def twinx (ax : matplotlib . axes . Axes | None = None ) -> _AxesBase :
1747
+ def twinx (ax : Axes | None = None ) -> _AxesBase :
1746
1748
"""
1747
1749
Make and return a second axes that shares the *x*-axis. The new axes will
1748
1750
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:
1758
1760
return ax1
1759
1761
1760
1762
1761
- def twiny (ax : matplotlib . axes . Axes | None = None ) -> _AxesBase :
1763
+ def twiny (ax : Axes | None = None ) -> _AxesBase :
1762
1764
"""
1763
1765
Make and return a second axes that shares the *y*-axis. The new axes will
1764
1766
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]:
2213
2215
@_copy_docstring_and_deprecators (Figure .colorbar )
2214
2216
def colorbar (
2215
2217
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 ,
2218
2220
** kwargs
2219
2221
) -> Colorbar :
2220
2222
if mappable is None :
0 commit comments