@@ -4603,29 +4603,34 @@ def test_hist_stacked_bar():
4603
4603
ax .legend (loc = 'upper right' , bbox_to_anchor = (1.0 , 1.0 ), ncols = 1 )
4604
4604
4605
4605
4606
- @image_comparison (['hist_vectorized_params_bar' , 'hist_vectorized_params_step' ],
4607
- extensions = ["png" ], remove_text = True )
4608
- def test_hist_vectorized_params ():
4606
+ @pytest .mark .parametrize ("histtype" , ["step" , "stepfilled" ])
4607
+ @pytest .mark .parametrize ("color" , [["blue" , "green" , "brown" ], [None ]* 3 ])
4608
+ @pytest .mark .parametrize ("edgecolor" , [["red" , "black" , "blue" ], [None ]* 3 ])
4609
+ @pytest .mark .parametrize ("facecolor" , [["blue" , "green" , "brown" ], [None ]* 3 ])
4610
+ @pytest .mark .parametrize ("linewidth" , [[1 , 1.5 , 2 ], [None ]* 3 ])
4611
+ @pytest .mark .parametrize ("hatch" , [["/" , "\\ " , "." ], [None ]* 3 ])
4612
+ @pytest .mark .parametrize ("linestyle" , [["-" , "--" , ":" ], [None ]* 3 ])
4613
+ @check_figures_equal (extensions = ["png" ])
4614
+ def test_hist_vectorized_params (fig_test , fig_ref , histtype , color , edgecolor ,
4615
+ facecolor , linewidth , hatch , linestyle ):
4609
4616
np .random .seed (19680801 )
4610
4617
x = [np .random .randn (n ) for n in [2000 , 5000 , 10000 ]]
4611
4618
4612
- for histtype in ['bar' , 'step' ]:
4613
- fig , axs = plt .subplots (2 , 3 , figsize = (8 , 6 ))
4614
- fig .delaxes (axs [1 , 1 ])
4615
- ax1 , ax2 , ax3 , ax4 , _ , ax6 = axs .flatten ()
4616
-
4617
- # Only linestyle
4618
- ax1 .hist (x , bins = 10 , histtype = histtype , linestyle = ["-" , "--" , ":" ])
4619
- # Only edgecolor
4620
- ax2 .hist (x , bins = 10 , histtype = histtype ,
4621
- edgecolor = ["red" , "black" , "blue" ])
4622
- # Only facecolor
4623
- ax3 .hist (x , bins = 10 , histtype = histtype ,
4624
- facecolor = ["blue" , "yellow" , "brown" ])
4625
- # Only linewidth
4626
- ax4 .hist (x , bins = 10 , histtype = histtype , linewidth = [1 , 1.5 , 2 ])
4627
- # Only hatch
4628
- ax6 .hist (x , bins = 10 , histtype = histtype , hatch = ["/" , "\\ " , "." ])
4619
+ facecolor = facecolor if facecolor [0 ] is not None else color
4620
+ if histtype == "step" :
4621
+ edgecolor = edgecolor if edgecolor [0 ] is not None else color
4622
+
4623
+ _ , bins , _ = fig_test .subplots ().hist (x , bins = 10 , histtype = histtype , color = color ,
4624
+ edgecolor = edgecolor , facecolor = facecolor ,
4625
+ linewidth = linewidth , hatch = hatch ,
4626
+ linestyle = linestyle )
4627
+ ref_ax = fig_ref .subplots ()
4628
+
4629
+ for xi , c , ec , fc , lw , hs , ls in zip (x , color [::- 1 ], edgecolor [::- 1 ],
4630
+ facecolor [::- 1 ], linewidth [::- 1 ],
4631
+ hatch [::- 1 ], linestyle [::- 1 ]):
4632
+ ref_ax .hist (xi , bins = bins , histtype = histtype , color = c , edgecolor = ec ,
4633
+ facecolor = fc , linewidth = lw , hatch = hs , linestyle = ls )
4629
4634
4630
4635
4631
4636
def test_hist_barstacked_bottom_unchanged ():
0 commit comments