Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 29dbdf3

Browse files
committed
Quiet sphinx warnings (by using axes.Axes instead of Axes already in the namespace)
1 parent d832950 commit 29dbdf3

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

lib/matplotlib/pyplot.py

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@
9595
)
9696

9797
from matplotlib.axis import Tick
98+
from matplotlib import axes
9899
from matplotlib.axes import SubplotBase
99100
from matplotlib.axes._base import _AxesBase
100101
from matplotlib.backend_bases import RendererBase, Event
@@ -1089,7 +1090,7 @@ def figlegend(*args, **kwargs) -> Legend:
10891090
def axes(
10901091
arg: None | tuple[float, float, float, float] = None,
10911092
**kwargs
1092-
) -> Axes:
1093+
) -> axes.Axes:
10931094
"""
10941095
Add an Axes to the current figure and make it the current Axes.
10951096
@@ -1175,7 +1176,7 @@ def axes(
11751176
return fig.add_axes(arg, **kwargs)
11761177

11771178

1178-
def delaxes(ax: Axes | None = None) -> None:
1179+
def delaxes(ax: axes.Axes | None = None) -> None:
11791180
"""
11801181
Remove an `~.axes.Axes` (defaulting to the current axes) from its figure.
11811182
"""
@@ -1413,7 +1414,7 @@ def subplots(
14131414
subplot_kw: dict[str, Any] | None = None,
14141415
gridspec_kw: dict[str, Any] | None = None,
14151416
**fig_kw
1416-
) -> tuple[Figure, Axes | np.ndarray | SubplotBase]:
1417+
) -> tuple[Figure, axes.Axes | np.ndarray | SubplotBase]:
14171418
"""
14181419
Create a figure and a set of subplots.
14191420
@@ -1577,7 +1578,7 @@ def subplot_mosaic(
15771578
gridspec_kw: dict[str, Any] | None = None,
15781579
per_subplot_kw: dict[Any, dict[str, Any]] | None = None,
15791580
**fig_kw
1580-
) -> tuple[Figure, dict[Any, Axes]]:
1581+
) -> tuple[Figure, dict[Any, axes.Axes]]:
15811582
"""
15821583
Build a layout of Axes based on ASCII art or nested lists.
15831584
@@ -1694,7 +1695,7 @@ def subplot2grid(
16941695
rowspan: int = 1, colspan: int = 1,
16951696
fig: Figure | None = None,
16961697
**kwargs
1697-
) -> Axes:
1698+
) -> axes.Axes:
16981699
"""
16991700
Create a subplot at a specific location inside a regular grid.
17001701
@@ -1756,7 +1757,7 @@ def subplot2grid(
17561757
return ax
17571758

17581759

1759-
def twinx(ax: Axes | None = None) -> _AxesBase:
1760+
def twinx(ax: axes.Axes | None = None) -> _AxesBase:
17601761
"""
17611762
Make and return a second axes that shares the *x*-axis. The new axes will
17621763
overlay *ax* (or the current axes if *ax* is *None*), and its ticks will be
@@ -1772,7 +1773,7 @@ def twinx(ax: Axes | None = None) -> _AxesBase:
17721773
return ax1
17731774

17741775

1775-
def twiny(ax: Axes | None = None) -> _AxesBase:
1776+
def twiny(ax: axes.Axes | None = None) -> _AxesBase:
17761777
"""
17771778
Make and return a second axes that shares the *y*-axis. The new axes will
17781779
overlay *ax* (or the current axes if *ax* is *None*), and its ticks will be
@@ -2227,8 +2228,8 @@ def _get_pyplot_commands() -> list[str]:
22272228
@_copy_docstring_and_deprecators(Figure.colorbar)
22282229
def colorbar(
22292230
mappable: ScalarMappable | None = None,
2230-
cax: Axes | None = None,
2231-
ax: Axes | Iterable[Axes] | None = None,
2231+
cax: axes.Axes | None = None,
2232+
ax: axes.Axes | Iterable[axes.Axes] | None = None,
22322233
**kwargs
22332234
) -> Colorbar:
22342235
if mappable is None:

0 commit comments

Comments
 (0)