From 0139aca5c61d3fba57aa2cf8de3e89bed0139372 Mon Sep 17 00:00:00 2001 From: Tim Hoffmann <2836374+timhoffm@users.noreply.github.com> Date: Thu, 17 Jul 2025 20:43:52 +0200 Subject: [PATCH] Backport PR #30321: Fix type annotation for Axes.get_legend() to include None --- lib/matplotlib/axes/_base.pyi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/matplotlib/axes/_base.pyi b/lib/matplotlib/axes/_base.pyi index df82ad7ec4a5..dcfcc4ca9027 100644 --- a/lib/matplotlib/axes/_base.pyi +++ b/lib/matplotlib/axes/_base.pyi @@ -224,7 +224,7 @@ class _AxesBase(martist.Artist): ymin: float | None = ..., ymax: float | None = ... ) -> tuple[float, float, float, float]: ... - def get_legend(self) -> Legend: ... + def get_legend(self) -> Legend | None: ... def get_images(self) -> list[AxesImage]: ... def get_lines(self) -> list[Line2D]: ... def get_xaxis(self) -> XAxis: ...
Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.
Alternative Proxies: