Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Backport PR #27504 on branch v3.8.x (DOC: correct return type for axline) #27506

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/matplotlib/axes/_axes.py
Original file line number Diff line number Diff line change
Expand Up @@ -893,7 +893,7 @@ def axline(self, xy1, xy2=None, *, slope=None, **kwargs):

Returns
-------
`.Line2D`
`.AxLine`

Other Parameters
----------------
Expand Down
4 changes: 2 additions & 2 deletions lib/matplotlib/axes/_axes.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ from matplotlib.contour import ContourSet, QuadContourSet
from matplotlib.image import AxesImage, PcolorImage
from matplotlib.legend import Legend
from matplotlib.legend_handler import HandlerBase
from matplotlib.lines import Line2D
from matplotlib.lines import Line2D, AxLine
from matplotlib.mlab import GaussianKDE
from matplotlib.patches import Rectangle, FancyArrow, Polygon, StepPatch, Wedge
from matplotlib.quiver import Quiver, QuiverKey, Barbs
Expand Down Expand Up @@ -151,7 +151,7 @@ class Axes(_AxesBase):
*,
slope: float | None = ...,
**kwargs
) -> Line2D: ...
) -> AxLine: ...
def axhspan(
self, ymin: float, ymax: float, xmin: float = ..., xmax: float = ..., **kwargs
) -> Polygon: ...
Expand Down
4 changes: 2 additions & 2 deletions lib/matplotlib/pyplot.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@

# We may not need the following imports here:
from matplotlib.colors import Normalize
from matplotlib.lines import Line2D
from matplotlib.lines import Line2D, AxLine
from matplotlib.text import Text, Annotation
from matplotlib.patches import Polygon, Rectangle, Circle, Arrow
from matplotlib.widgets import Button, Slider, Widget
Expand Down Expand Up @@ -2721,7 +2721,7 @@ def axline(
*,
slope: float | None = None,
**kwargs,
) -> Line2D:
) -> AxLine:
return gca().axline(xy1, xy2=xy2, slope=slope, **kwargs)


Expand Down