Skip to content

Commit 45dbc9b

Browse files
authored
Merge pull request #6753 from anntzer/dont-warn-on-empty-legend
Don't warn when legend() finds no labels.
2 parents ed8138e + 2fd8362 commit 45dbc9b

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
Removal of warning on empty legends
2+
```````````````````````````````````
3+
4+
``plt.legend`` used to issue a warning when no labeled artist could be found.
5+
This warning has been removed.

lib/matplotlib/axes/_axes.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -547,8 +547,6 @@ def legend(self, *args, **kwargs):
547547
elif len(args) == 0:
548548
handles, labels = self.get_legend_handles_labels(handlers)
549549
if not handles:
550-
warnings.warn("No labelled objects found. "
551-
"Use label='...' kwarg on individual plots.")
552550
return None
553551

554552
# One argument. User defined labels - automatic handle detection.

0 commit comments

Comments
 (0)