Skip to content

Commit

Permalink
TST: Address UserWarning in matplotlib test (pandas-dev#59168)
Browse files Browse the repository at this point in the history
* TST: Address UserWarning in matplotlib test

* Filter the warning instead
  • Loading branch information
mroeschke authored Jul 3, 2024
1 parent 684faf7 commit dcb5494
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion pandas/plotting/_matplotlib/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit dcb5494

Please sign in to comment.