Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 0de9c18

Browse files
authored
Merge pull request #20958 from meeseeksmachine/auto-backport-of-pr-20956-on-v3.5.x
Backport PR #20956 on branch v3.5.x (Make warning for no-handles legend more explicit.)
2 parents 60ccae3 + f8536e6 commit 0de9c18

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)