From 7457ba43b8362bb43de954fc46897e9da7738e02 Mon Sep 17 00:00:00 2001 From: Kyle Sunden Date: Thu, 1 Aug 2024 13:57:56 -0500 Subject: [PATCH] Backport PR #28625: added typing_extensions.Self to _AxesBase.twinx --- lib/matplotlib/axes/_base.pyi | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/matplotlib/axes/_base.pyi b/lib/matplotlib/axes/_base.pyi index 751dcd248a5c..8cd88a92cc09 100644 --- a/lib/matplotlib/axes/_base.pyi +++ b/lib/matplotlib/axes/_base.pyi @@ -4,6 +4,7 @@ import datetime from collections.abc import Callable, Iterable, Iterator, Sequence from matplotlib import cbook from matplotlib.artist import Artist +from matplotlib.axes import Axes from matplotlib.axis import XAxis, YAxis, Tick from matplotlib.backend_bases import RendererBase, MouseButton, MouseEvent from matplotlib.cbook import CallbackRegistry @@ -384,8 +385,8 @@ class _AxesBase(martist.Artist): bbox_extra_artists: Sequence[Artist] | None = ..., for_layout_only: bool = ... ) -> Bbox | None: ... - def twinx(self) -> _AxesBase: ... - def twiny(self) -> _AxesBase: ... + def twinx(self) -> Axes: ... + def twiny(self) -> Axes: ... def get_shared_x_axes(self) -> cbook.GrouperView: ... def get_shared_y_axes(self) -> cbook.GrouperView: ... def label_outer(self, remove_inner_ticks: bool = ...) -> None: ...