From 9531b8aba3f7c28c9a4eb5e1cc85e5884e65156c Mon Sep 17 00:00:00 2001 From: Ruth Comer <10599679+rcomer@users.noreply.github.com> Date: Tue, 12 Dec 2023 11:47:37 +0000 Subject: [PATCH] DOC: correct return type for axline [ci doc] --- lib/matplotlib/axes/_axes.py | 2 +- lib/matplotlib/axes/_axes.pyi | 4 ++-- lib/matplotlib/pyplot.py | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/matplotlib/axes/_axes.py b/lib/matplotlib/axes/_axes.py index 358b12ca563d..5392a592314c 100644 --- a/lib/matplotlib/axes/_axes.py +++ b/lib/matplotlib/axes/_axes.py @@ -895,7 +895,7 @@ def axline(self, xy1, xy2=None, *, slope=None, **kwargs): Returns ------- - `.Line2D` + `.AxLine` Other Parameters ---------------- diff --git a/lib/matplotlib/axes/_axes.pyi b/lib/matplotlib/axes/_axes.pyi index 51e905517f3d..919a22872999 100644 --- a/lib/matplotlib/axes/_axes.pyi +++ b/lib/matplotlib/axes/_axes.pyi @@ -17,7 +17,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 @@ -150,7 +150,7 @@ class Axes(_AxesBase): *, slope: float | None = ..., **kwargs - ) -> Line2D: ... + ) -> AxLine: ... def axhspan( self, ymin: float, ymax: float, xmin: float = ..., xmax: float = ..., **kwargs ) -> Polygon: ... diff --git a/lib/matplotlib/pyplot.py b/lib/matplotlib/pyplot.py index 1255818b41b5..9272855d06ec 100644 --- a/lib/matplotlib/pyplot.py +++ b/lib/matplotlib/pyplot.py @@ -129,7 +129,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 @@ -2720,7 +2720,7 @@ def axline( *, slope: float | None = None, **kwargs, -) -> Line2D: +) -> AxLine: return gca().axline(xy1, xy2=xy2, slope=slope, **kwargs)