File tree Expand file tree Collapse file tree 2 files changed +13
-0
lines changed Expand file tree Collapse file tree 2 files changed +13
-0
lines changed Original file line number Diff line number Diff line change @@ -459,6 +459,7 @@ def __init__(
459459 labels = [* reversed (labels )]
460460 handles = [* reversed (handles )]
461461
462+ handles = list (handles )
462463 if len (handles ) < 2 :
463464 ncols = 1
464465 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():
4242 loc = 'center left' , bbox_to_anchor = (1 , .5 ))
4343
4444
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+
4557@image_comparison (['legend_auto1.png' ], remove_text = True )
4658def test_legend_auto1 ():
4759 """Test automatic legend placement"""
You can’t perform that action at this time.
0 commit comments