Skip to content

Commit 400d507

Browse files
authored
Merge pull request #28423 from chrille0313/docfix-for-issue-28417
Update return type for Axes.axhspan and Axes.axvspan
2 parents c9bda41 + f0aaec9 commit 400d507

File tree

3 files changed

+10
-10
lines changed

3 files changed

+10
-10
lines changed

lib/matplotlib/axes/_axes.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1006,14 +1006,14 @@ def axhspan(self, ymin, ymax, xmin=0, xmax=1, **kwargs):
10061006
10071007
Returns
10081008
-------
1009-
`~matplotlib.patches.Polygon`
1009+
`~matplotlib.patches.Rectangle`
10101010
Horizontal span (rectangle) from (xmin, ymin) to (xmax, ymax).
10111011
10121012
Other Parameters
10131013
----------------
1014-
**kwargs : `~matplotlib.patches.Polygon` properties
1014+
**kwargs : `~matplotlib.patches.Rectangle` properties
10151015
1016-
%(Polygon:kwdoc)s
1016+
%(Rectangle:kwdoc)s
10171017
10181018
See Also
10191019
--------
@@ -1061,14 +1061,14 @@ def axvspan(self, xmin, xmax, ymin=0, ymax=1, **kwargs):
10611061
10621062
Returns
10631063
-------
1064-
`~matplotlib.patches.Polygon`
1064+
`~matplotlib.patches.Rectangle`
10651065
Vertical span (rectangle) from (xmin, ymin) to (xmax, ymax).
10661066
10671067
Other Parameters
10681068
----------------
1069-
**kwargs : `~matplotlib.patches.Polygon` properties
1069+
**kwargs : `~matplotlib.patches.Rectangle` properties
10701070
1071-
%(Polygon:kwdoc)s
1071+
%(Rectangle:kwdoc)s
10721072
10731073
See Also
10741074
--------

lib/matplotlib/axes/_axes.pyi

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -155,10 +155,10 @@ class Axes(_AxesBase):
155155
) -> AxLine: ...
156156
def axhspan(
157157
self, ymin: float, ymax: float, xmin: float = ..., xmax: float = ..., **kwargs
158-
) -> Polygon: ...
158+
) -> Rectangle: ...
159159
def axvspan(
160160
self, xmin: float, xmax: float, ymin: float = ..., ymax: float = ..., **kwargs
161-
) -> Polygon: ...
161+
) -> Rectangle: ...
162162
def hlines(
163163
self,
164164
y: float | ArrayLike,

lib/matplotlib/pyplot.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2882,7 +2882,7 @@ def axhline(y: float = 0, xmin: float = 0, xmax: float = 1, **kwargs) -> Line2D:
28822882
@_copy_docstring_and_deprecators(Axes.axhspan)
28832883
def axhspan(
28842884
ymin: float, ymax: float, xmin: float = 0, xmax: float = 1, **kwargs
2885-
) -> Polygon:
2885+
) -> Rectangle:
28862886
return gca().axhspan(ymin, ymax, xmin=xmin, xmax=xmax, **kwargs)
28872887

28882888

@@ -2920,7 +2920,7 @@ def axvline(x: float = 0, ymin: float = 0, ymax: float = 1, **kwargs) -> Line2D:
29202920
@_copy_docstring_and_deprecators(Axes.axvspan)
29212921
def axvspan(
29222922
xmin: float, xmax: float, ymin: float = 0, ymax: float = 1, **kwargs
2923-
) -> Polygon:
2923+
) -> Rectangle:
29242924
return gca().axvspan(xmin, xmax, ymin=ymin, ymax=ymax, **kwargs)
29252925

29262926

0 commit comments

Comments
 (0)