@@ -676,53 +676,49 @@ def test_no_warn_big_data_when_loc_specified():
676676def test_plot_multiple_input_multiple_label ():
677677 # test ax.plot() with multidimensional input
678678 # and multiple labels
679- x = [1 , 2 , 5 ]
680- y = [[2 , 4 , 3 ], [ 4 , 7 , 1 ], [ 3 , 9 , 2 ]]
681-
682- label_arrays = [[ 'one' , 'two' , 'three' ],
683- ( 'one ' , 'two' , 'three' ) ,
684- np . array ([ 'one ' , 'two' , 'three' ])]
685-
679+ x = [1 , 2 , 3 ]
680+ y = [[1 , 2 ],
681+ [ 2 , 5 ],
682+ [ 4 , 9 ]]
683+ label_arrays = [[ 'low ' , 'high' ] ,
684+ ( 'low ' , 'high' ),
685+ np . array ([ 'low' , 'high' ])]
686686 for label in label_arrays :
687687 fig , ax = plt .subplots ()
688688 ax .plot (x , y , label = label )
689689 leg = ax .legend ()
690-
691690 legend_texts = [entry .get_text () for entry in leg .get_texts ()]
692- assert legend_texts == ['one ' , 'two' , 'three ' ]
691+ assert legend_texts == ['low ' , 'high ' ]
693692
694693
695694def test_plot_multiple_input_single_label ():
696695 # test ax.plot() with multidimensional input
697696 # and single label
698- x = [1 , 2 , 5 ]
699- y = [[2 , 4 , 3 ], [4 , 7 , 1 ], [3 , 9 , 2 ]]
697+ x = [1 , 2 , 3 ]
698+ y = [[1 , 2 ],
699+ [2 , 5 ],
700+ [4 , 9 ]]
700701 labels = ['one' , 1 , int ]
701-
702702 for label in labels :
703703 fig , ax = plt .subplots ()
704704 ax .plot (x , y , label = label )
705705 leg = ax .legend ()
706-
707706 legend_texts = [entry .get_text () for entry in leg .get_texts ()]
708- assert legend_texts == [str (label )] * 3
707+ assert legend_texts == [str (label )] * 2
709708
710709
711710def test_plot_single_input_multiple_label ():
712711 # test ax.plot() with 1D array like input
713712 # and iterable label
714- x = [1 , 2 , 5 ]
715- y = [2 , 4 , 3 ]
716-
717- label_arrays = [['one' , 'two' , 'three' ],
718- ('one' , 'two' , 'three' ),
719- np .array (['one' , 'two' , 'three' ])]
720-
713+ x = [1 , 2 , 3 ]
714+ y = [2 , 5 , 6 ]
715+ label_arrays = [['low' , 'high' ],
716+ ('low' , 'high' ),
717+ np .array (['low' , 'high' ])]
721718 for label in label_arrays :
722719 fig , ax = plt .subplots ()
723720 ax .plot (x , y , label = label )
724721 leg = ax .legend ()
725-
726722 assert len (leg .get_texts ()) == 1
727723 assert leg .get_texts ()[0 ].get_text () == str (label )
728724
@@ -731,8 +727,10 @@ def test_plot_multiple_label_incorrect_length_exception():
731727 # check that excepton is raised if multiple labels
732728 # are given, but number of on labels != number of lines
733729 with pytest .raises (ValueError ):
734- x = [1 , 2 , 5 ]
735- y = [[2 , 4 , 3 ], [4 , 7 , 1 ], [3 , 9 , 2 ]]
736- label = ['one' , 'two' ]
730+ x = [1 , 2 , 3 ]
731+ y = [[1 , 2 ],
732+ [2 , 5 ],
733+ [4 , 9 ]]
734+ label = ['high' , 'low' , 'medium' ]
737735 fig , ax = plt .subplots ()
738736 ax .plot (x , y , label = label )
0 commit comments