Commit dfa19f6
[BUG] Warn when legend() receives mismatched handles and labels in 2-argument positional form (#31315)
* Implement warning for mismatched legend handles and labels
Add warning for mismatched handles and labels in legend.
* Add regression test for legend argument mismatch
Add regression test for mismatched handles and labels in legend.
* Fix regression test message for legend mismatch
* Fix indentation for test_legend_mismatched_positional_args
* Update lib/matplotlib/legend.py
Co-authored-by: Tim Hoffmann <[email protected]>
* Rename test for legend mismatched arguments
* Update lib/matplotlib/tests/test_legend.py
Co-authored-by: Tim Hoffmann <[email protected]>
* Implement warning test for legend handle-label mismatch
Added a test to warn on unequal number of handles and labels in legend.
* Add test for legend position argument handling
* Update warning message for legend handle mismatch
* Fix legend creation with list of labels
* gracefully handle generators in mismatch warning
* Update warning message for legend handle mismatch
* Update lib/matplotlib/legend.py
Co-authored-by: Tim Hoffmann <[email protected]>
---------
Co-authored-by: Tim Hoffmann <[email protected]>1 parent 02b42db commit dfa19f6
2 files changed
Lines changed: 15 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1385 | 1385 | | |
1386 | 1386 | | |
1387 | 1387 | | |
| 1388 | + | |
| 1389 | + | |
| 1390 | + | |
| 1391 | + | |
| 1392 | + | |
1388 | 1393 | | |
1389 | 1394 | | |
1390 | 1395 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
292 | 292 | | |
293 | 293 | | |
294 | 294 | | |
295 | | - | |
| 295 | + | |
296 | 296 | | |
297 | 297 | | |
298 | 298 | | |
| |||
424 | 424 | | |
425 | 425 | | |
426 | 426 | | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
427 | 436 | | |
428 | 437 | | |
429 | 438 | | |
| |||
0 commit comments