10000 Backport PR #20956: Make warning for no-handles legend more explicit. · matplotlib/matplotlib@f8536e6 · GitHub
[go: up one dir, main page]

Skip to content

Commit f8536e6

Browse files
timhoffmmeeseeksmachine
authored andcommitted
Backport PR #20956: Make warning for no-handles legend more explicit.
1 parent 60ccae3 commit f8536e6

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

lib/matplotlib/legend.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1224,7 +1224,10 @@ def _parse_legend_args(axs, *args, handles=None, labels=None, **kwargs):
12241224
elif len(args) == 0:
12251225
handles, labels = _get_legend_handles_labels(axs, handlers)
12261226
if not handles:
1227-
log.warning('No handles with labels found to put in legend.')
1227+
log.warning(
1228+
"No artists with labels found to put in legend. Note that "
1229+
"artists whose label start with an underscore are ignored "
1230+
"when legend() is called with no argument.")
12281231

12291232
# One argument. User defined labels - automatic handle detection.
12301233
elif len(args) == 1:

0 commit comments

Comments
 (0)
0