@@ -1672,6 +1672,30 @@ def test_hist2d():
1672
1672
ax .hist2d ("x" , "y" , bins = 10 , data = data , rasterized = True )
1673
1673
1674
1674
1675
+ @pytest .mark .parametrize ('density' , [False , True ])
1676
+ def test_hist2d_density (density ):
1677
+ # Test density kwarg
1678
+ x = np .random .randn (100 )* 2 + 5
1679
+ y = np .random .randn (100 )- 2
1680
+ fig = plt .figure ()
1681
+ ax = fig .add_subplot (111 )
1682
+ ax .hist2d (x , y , bins = 10 , rasterized = True , density = density )
1683
+
1684
+
1685
+ @pytest .mark .parametrize ('normed' , [False , True ])
1686
+ @pytest .mark .parametrize ('density' , [False , True ])
1687
+ def test_hist2d_normed_density (density , normed ):
1688
+ # Normed and density should not be used simultaneously
1689
+ x = np .random .randn (100 )* 2 + 5
1690
+ y = np .random .randn (100 )- 2
1691
+ fig = plt .figure ()
1692
+ ax = fig .add_subplot (111 )
1693
+ # test that kwargs normed and density cannot be set both.
1694
+ with pytest .raises (ValueError , match = "kwargs 'density' and 'normed'" ):
1695
+ ax .hist2d (x , y , bins = 10 , rasterized = True ,
1696
+ density = density , normed = normed )
1697
+
1698
+
1675
1699
@image_comparison (baseline_images = ['hist2d_transpose' ],
1676
1700
remove_text = True , style = 'mpl20' )
1677
1701
def test_hist2d_transpose ():
0 commit comments