Skip to content

Commit dcb5494

Browse files
authored
TST: Address UserWarning in matplotlib test (pandas-dev#59168)
* TST: Address UserWarning in matplotlib test * Filter the warning instead
1 parent 684faf7 commit dcb5494

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

pandas/plotting/_matplotlib/core.py

+7-1
Original file line numberDiff line numberDiff line change
@@ -893,7 +893,13 @@ def _make_legend(self) -> None:
893893
elif self.subplots and self.legend:
894894
for ax in self.axes:
895895
if ax.get_visible():
896-
ax.legend(loc="best")
896+
with warnings.catch_warnings():
897+
warnings.filterwarnings(
898+
"ignore",
899+
"No artists with labels found to put in legend.",
900+
UserWarning,
901+
)
902+
ax.legend(loc="best")
897903

898904
@final
899905
@staticmethod

0 commit comments

Comments
 (0)