@@ -3992,6 +3992,78 @@ def test_hlines():
3992
3992
ax5 .set_ylim (0 , 15 )
3993
3993
3994
3994
3995
+ @check_figures_equal ()
3996
+ def test_vlines_with_nan_colors (fig_test , fig_ref ):
3997
+ colors1 = ['red' , 'green' , 'blue' , 'purple' , 'orange' , 'black' ]
3998
+ x1 = [2 , 3 , 4 , 5 , 6 , 7 ]
3999
+ y1 = [2 , - 6 , 3 , 8 , np .nan , 2 ]
4000
+
4001
+ fig_test , ax1 = plt .subplots ()
4002
+ ax1 .vlines (x1 , 0 , y1 , colors = colors1 , linewidth = 5 )
4003
+
4004
+ colors2 = ['red' , 'green' , 'blue' , 'purple' , 'black' ]
4005
+ x2 = [2 , 3 , 4 , 5 , 7 ]
4006
+ y2 = [2 , - 6 , 3 , 8 , 2 ]
4007
+ # Reference image
4008
+ fig_ref , ax2 = plt .subplots ()
4009
+ ax2 .vlines (x2 , 0 , y2 , colors = colors2 , linewidth = 5 )
4010
+
4011
+
4012
+ @check_figures_equal ()
4013
+ def test_vlines_with_masked_colors (fig_test , fig_ref ):
4014
+ colors1 = ['red' , 'green' , 'blue' , 'purple' , 'orange' , 'black' ]
4015
+ fig_test , ax1 = plt .subplots ()
4016
+ x1 = np .ma .masked_equal ([2 , 4 , 6 , 8 , 10 , 12 ], 8 )
4017
+ ymin1 = np .ma .masked_equal ([0 , 1 , - 1 , 0 , 2 , 1 ], 2 )
4018
+ ymax1 = np .ma .masked_equal ([13 , 14 , 15 , 16 , 17 , 18 ], 18 )
4019
+ ax1 .vlines (x1 , ymin1 , ymax1 , colors = colors1 , linewidth = 2 )
4020
+ ax1 .set_xlim (0 , 15 )
4021
+
4022
+ colors2 = ['red' , 'green' , 'blue' ]
4023
+ fig_ref , ax2 = plt .subplots ()
4024
+ x2 = np .asarray ([2 , 4 , 6 ])
4025
+ ymin2 = np .asarray ([0 , 1 , - 1 ])
4026
+ ymax2 = np .asarray ([13 , 14 , 15 ])
4027
+ ax2 .vlines (x2 , ymin2 , ymax2 , colors = colors2 , linewidth = 2 )
4028
+ ax2 .set_xlim (0 , 15 )
4029
+
4030
+
4031
+ @check_figures_equal ()
4032
+ def test_hlines_with_nan_colors (fig_test , fig_ref ):
4033
+ colors1 = ['red' , 'green' , 'blue' , 'purple' , 'orange' , 'black' ]
4034
+ x1 = [2 , 3 , 4 , 5 , 6 , 7 ]
4035
+ y1 = [2 , - 6 , 3 , 8 , np .nan , 2 ]
4036
+
4037
+ fig_test , ax1 = plt .subplots ()
4038
+ ax1 .vlines (y1 , 0 , x1 , colors = colors1 , linewidth = 5 )
4039
+
4040
+ colors2 = ['red' , 'green' , 'blue' , 'purple' , 'black' ]
4041
+ x2 = [2 , 3 , 4 , 5 , 7 ]
4042
+ y2 = [2 , - 6 , 3 , 8 , 2 ]
4043
+ # Reference image
4044
+ fig_ref , ax2 = plt .subplots ()
4045
+ ax2 .vlines (y2 , 0 , x2 , colors = colors2 , linewidth = 5 )
4046
+
4047
+
4048
+ @check_figures_equal ()
4049
+ def test_hlines_with_masked_colors (fig_test , fig_ref ):
4050
+ colors1 = ['red' , 'green' , 'blue' , 'purple' , 'orange' , 'black' ]
4051
+ fig_test , ax1 = plt .subplots ()
4052
+ y1 = np .ma .masked_equal ([2 , 4 , 6 , 8 , 10 , 12 ], 8 )
4053
+ xmin1 = np .ma .masked_equal ([0 , 1 , - 1 , 0 , 2 , 1 ], 2 )
4054
+ xmax1 = np .ma .masked_equal ([13 , 14 , 15 , 16 , 17 , 18 ], 18 )
4055
+ ax1 .vlines (y1 , xmin1 , xmax1 , colors = colors1 , linewidth = 2 )
4056
+ ax1 .set_xlim (0 , 15 )
4057
+
4058
+ colors2 = ['red' , 'green' , 'blue' ]
4059
+ fig_ref , ax2 = plt .subplots ()
4060
+ y2 = np .asarray ([2 , 4 , 6 ])
4061
+ xmin2 = np .asarray ([0 , 1 , - 1 ])
4062
+ xmax2 = np .asarray ([13 , 14 , 15 ])
4063
+ ax2 .vlines (y2 , xmin2 , xmax2 , colors = colors2 , linewidth = 2 )
4064
+ ax2 .set_xlim (0 , 15 )
4065
+
4066
+
3995
4067
@image_comparison (['step_linestyle' , 'step_linestyle' ], remove_text = True )
3996
4068
def test_step_linestyle ():
3997
4069
x = y = np .arange (10 )
0 commit comments