Markéta Machová
764bd51d96
OBS-URL: https://build.opensuse.org/package/show/devel:languages:python:numeric/python-pandas?expand=0&rev=122
30 lines
1.1 KiB
Diff
30 lines
1.1 KiB
Diff
From d4e803caf7aabd464f6fb1d43ef39903911a3cec Mon Sep 17 00:00:00 2001
|
|
From: Matthew Roeschke <10647082+mroeschke@users.noreply.github.com>
|
|
Date: Wed, 3 Jul 2024 06:45:24 -1000
|
|
Subject: [PATCH] Backport PR #59168: TST: Address UserWarning in matplotlib
|
|
test
|
|
|
|
---
|
|
pandas/plotting/_matplotlib/core.py | 8 +++++++-
|
|
1 file changed, 7 insertions(+), 1 deletion(-)
|
|
|
|
diff --git a/pandas/plotting/_matplotlib/core.py b/pandas/plotting/_matplotlib/core.py
|
|
index 2979903edf360..52382d9f7d572 100644
|
|
--- a/pandas/plotting/_matplotlib/core.py
|
|
+++ b/pandas/plotting/_matplotlib/core.py
|
|
@@ -893,7 +893,13 @@ def _make_legend(self) -> None:
|
|
elif self.subplots and self.legend:
|
|
for ax in self.axes:
|
|
if ax.get_visible():
|
|
- ax.legend(loc="best")
|
|
+ with warnings.catch_warnings():
|
|
+ warnings.filterwarnings(
|
|
+ "ignore",
|
|
+ "No artists with labels found to put in legend.",
|
|
+ UserWarning,
|
|
+ )
|
|
+ ax.legend(loc="best")
|
|
|
|
@final
|
|
@staticmethod
|