@@ -2786,35 +2786,16 @@ def test_hist_stacked_density():
2786
2786
ax .hist ((d1 , d2 ), stacked = True , density = True )
2787
2787
2788
2788
2789
- def test_hist_normed_density ():
2789
+ @pytest .mark .parametrize ('normed' , [False , True ])
2790
+ @pytest .mark .parametrize ('density' , [False , True ])
2791
+ def test_hist_normed_density (normed , density ):
2790
2792
# Normed and density should not be used simultaneously
2791
2793
d1 = np .linspace (1 , 3 , 20 )
2792
2794
d2 = np .linspace (0 , 10 , 50 )
2793
- fig = plt .figure ()
2794
- ax = fig .add_subplot (111 )
2795
+ fig , ax = plt .subplots ()
2795
2796
# test that kwargs normed and density cannot be set both.
2796
2797
with pytest .raises (Exception ):
2797
- ax .hist ((d1 , d2 ), stacked = True , normed = True , density = True )
2798
-
2799
- with pytest .raises (Exception ):
2800
- ax .hist ((d1 , d2 ), stacked = True , normed = False , density = True )
2801
-
2802
- with pytest .raises (Exception ):
2803
- ax .hist ((d1 , d2 ), stacked = True , normed = False , density = False )
2804
-
2805
- with pytest .raises (Exception ):
2806
- ax .hist ((d1 , d2 ), stacked = True , normed = True , density = False )
2807
-
2808
-
2809
- def test_hist_stacked_density ():
2810
- # make some data
2811
- d1 = np .linspace (1 , 3 , 20 )
2812
- d2 = np .linspace (0 , 10 , 50 )
2813
- fig , ax = plt .subplots ()
2814
- ax .hist ((d1 , d2 ), stacked = True , density = True )
2815
-
2816
- with pytest .raises (ValueError ):
2817
- ax .hist ((d1 , d2 ), stacked = True , density = True , normed = False )
2798
+ ax .hist ((d1 , d2 ), stacked = True , normed = normed , density = density )
2818
2799
2819
2800
2820
2801
@image_comparison (baseline_images = ['hist_step_bottom' ], extensions = ['png' ],
0 commit comments