File tree 2 files changed +13
-0
lines changed
2 files changed +13
-0
lines changed Original file line number Diff line number Diff line change @@ -459,6 +459,7 @@ def __init__(
459
459
labels = [* reversed (labels )]
460
460
handles = [* reversed (handles )]
461
461
462
+ handles = list (handles )
462
463
if len (handles ) < 2 :
463
464
ncols = 1
464
465
self ._ncols = ncols if ncols != 1 else ncol
Original file line number Diff line number Diff line change @@ -42,6 +42,18 @@ def test_legend_ordereddict():
42
42
loc = 'center left' , bbox_to_anchor = (1 , .5 ))
43
43
44
44
45
+ def test_legend_generator ():
46
+ # smoketest that generator inputs work
47
+ fig , ax = plt .subplots ()
48
+ ax .plot ([0 , 1 ])
49
+ ax .plot ([0 , 2 ])
50
+
51
+ handles = (line for line in ax .get_lines ())
52
+ labels = (label for label in ['spam' , 'eggs' ])
53
+
54
+ ax .legend (handles , labels , loc = 'upper left' )
55
+
56
+
45
57
@image_comparison (['legend_auto1.png' ], remove_text = True )
46
58
def test_legend_auto1 ():
47
59
"""Test automatic legend placement"""
You can’t perform that action at this time.
0 commit comments