Skip to content

Commit ceb794c

Browse files
authored
Merge pull request #20956 from anntzer/lhu
Make warning for no-handles legend more explicit.
2 parents 6d56592 + fc7bc44 commit ceb794c

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

lib/matplotlib/legend.py

+4-1
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)