@@ -4603,37 +4603,56 @@ 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
- @pytest .mark .parametrize ("histtype" , ["step" , "stepfilled" ])
4607
- @pytest .mark .parametrize ("color" , [["blue" , "green" , "brown" ], None ])
4608
- @pytest .mark .parametrize ("edgecolor" , [["red" , "black" , "blue" ], [None ]* 3 ])
4609
- @pytest .mark .parametrize ("facecolor" , [["blue" , "green" , "brown" ], [None ]* 3 ])
4610
4606
@check_figures_equal (extensions = ["png" ])
4611
- def test_hist_vectorized_params (fig_test , fig_ref , histtype , color , edgecolor ,
4612
- facecolor ):
4607
+ def test_hist_vectorized_params (fig_test , fig_ref ):
4613
4608
np .random .seed (19680801 )
4614
4609
x = [np .random .randn (n ) for n in [2000 , 5000 , 10000 ]]
4615
- linewidth = [1 , 1.5 , 2 ]
4610
+
4611
+ facecolor = ["b" , "g" , "r" ]
4612
+ edgecolor = ["b" , "g" , "r" ]
4616
4613
hatch = ["/" , "\\ " , "." ]
4617
4614
linestyle = ["-" , "--" , ":" ]
4615
+ linewidth = [1 , 1.5 , 2 ]
4616
+ colors = ["b" , "g" , "r" ]
4617
+ ((axt1 , axt2 , axt3 ), (axt4 , axt5 , axt6 )) = fig_test .subplots (2 , 3 )
4618
+ ((axr1 , axr2 , axr3 ), (axr4 , axr5 , axr6 )) = fig_ref .subplots (2 , 3 )
4619
+
4620
+ _ , bins , _ = axt1 .hist (x , bins = 10 , histtype = "stepfilled" , facecolor = facecolor )
4621
+
4622
+ for i , (xi , fc ) in enumerate (zip (x , facecolor )):
4623
+ axr1 .hist (xi , bins = bins , histtype = "stepfilled" , facecolor = fc ,
4624
+ zorder = (len (x )- i )/ 2 )
4625
+
4626
+ _ , bins , _ = axt2 .hist (x , bins = 10 , histtype = "step" , edgecolor = edgecolor )
4627
+
4628
+ for i , (xi , ec ) in enumerate (zip (x , edgecolor )):
4629
+ axr2 .hist (xi , bins = bins , histtype = "step" , edgecolor = ec , zorder = (len (x )- i )/ 2 )
4630
+
4631
+ _ , bins , _ = axt3 .hist (x , bins = 10 , histtype = "stepfilled" , hatch = hatch ,
4632
+ facecolor = facecolor )
4633
+
4634
+ for i , (xi , fc , ht ) in enumerate (zip (x , facecolor , hatch )):
4635
+ axr3 .hist (xi , bins = bins , histtype = "stepfilled" , hatch = ht , facecolor = fc ,
4636
+ zorder = (len (x )- i )/ 2 )
4637
+
4638
+ _ , bins , _ = axt4 .hist (x , bins = 10 , histtype = "step" , linestyle = linestyle ,
4639
+ edgecolor = edgecolor )
4640
+
4641
+ for i , (xi , ec , ls ) in enumerate (zip (x , edgecolor , linestyle )):
4642
+ axr4 .hist (xi , bins = bins , histtype = "step" , linestyle = ls , edgecolor = ec ,
4643
+ zorder = (len (x )- i )/ 2 )
4644
+
4645
+ _ , bins , _ = axt5 .hist (x , bins = 10 , histtype = "step" , linewidth = linewidth ,
4646
+ edgecolor = edgecolor )
4647
+
4648
+ for i , (xi , ec , lw ) in enumerate (zip (x , edgecolor , linewidth )):
4649
+ axr5 .hist (xi , bins = bins , histtype = "step" , linewidth = lw , edgecolor = ec ,
4650
+ zorder = (len (x )- i )/ 2 )
4651
+
4652
+ _ , bins , _ = axt6 .hist (x , bins = 10 , histtype = "stepfilled" , color = colors )
4618
4653
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
- color = [None ]* 3 if color is None else color
4629
- edgecolor = [None ]* 3 if edgecolor is None else edgecolor
4630
- facecolor = [None ]* 3 if facecolor is None else facecolor
4631
-
4632
- for i in range (2 , - 1 , - 1 ):
4633
- ref_ax .hist (x [i ], bins = bins , histtype = histtype , color = color [i ],
4634
- edgecolor = edgecolor [i ], facecolor = facecolor [i ],
4635
- linewidth = linewidth [i ], hatch = hatch [i ],
4636
- linestyle = linestyle [i ])
4654
+ for i , (xi , c ) in enumerate (zip (x , colors )):
4655
+ axr6 .hist (xi , bins = bins , histtype = "stepfilled" , color = c , zorder = (len (x )- i )/ 2 )
4637
4656
4638
4657
4639
4658
def test_hist_barstacked_bottom_unchanged ():
0 commit comments