@@ -129,6 +129,17 @@ def test_plot_fails_when_ax_differs_from_figure(self):
129
129
with pytest .raises (AssertionError ):
130
130
self .ts .hist (ax = ax1 , figure = fig2 )
131
131
132
+ @pytest .mark .parametrize (
133
+ "histtype, expected" ,
134
+ [("bar" , True ), ("barstacked" , True ), ("step" , False ), ("stepfilled" , True )],
135
+ )
136
+ def test_histtype_argument (self , histtype , expected ):
137
+ # GH23992 Verify functioning of histtype argument
138
+ ser = Series (np .random .randint (1 , 10 ))
139
+ ax = ser .hist (bins = 12 , alpha = 0.5 , histtype = histtype )
140
+ for patch in ax .patches :
141
+ assert patch .fill is expected
142
+
132
143
@pytest .mark .parametrize (
133
144
"by, expected_axes_num, expected_layout" , [(None , 1 , (1 , 1 )), ("b" , 2 , (1 , 2 ))]
134
145
)
@@ -365,6 +376,18 @@ def test_hist_column_order_unchanged(self, column, expected):
365
376
366
377
assert result == expected
367
378
379
+ @pytest .mark .parametrize (
380
+ "histtype, expected" ,
381
+ [("bar" , True ), ("barstacked" , True ), ("step" , False ), ("stepfilled" , True )],
382
+ )
383
+ def test_histtype_argument (self , histtype , expected ):
384
+ # GH23992 Verify functioning of histtype argument
385
+ df = DataFrame (np .random .randint (1 , 10 , size = (100 , 2 )), columns = ["a" , "b" ])
386
+ axes = df .hist (bins = 12 , alpha = 0.5 , histtype = histtype )
387
+ for ax in axes [0 ]:
388
+ for patch in ax .patches :
389
+ assert patch .fill is expected
390
+
368
391
@pytest .mark .parametrize ("by" , [None , "c" ])
369
392
@pytest .mark .parametrize ("column" , [None , "b" ])
370
393
def test_hist_with_legend (self , by , column ):
@@ -595,3 +618,18 @@ def test_axis_share_xy(self):
595
618
596
619
assert ax1 ._shared_y_axes .joined (ax1 , ax2 )
597
620
assert ax2 ._shared_y_axes .joined (ax1 , ax2 )
621
+
622
+ @pytest .mark .parametrize (
623
+ "histtype, expected" ,
624
+ [("bar" , True ), ("barstacked" , True ), ("step" , False ), ("stepfilled" , True )],
625
+ )
626
+ def test_histtype_argument (self , histtype , expected ):
627
+ # GH23992 Verify functioning of histtype argument
628
+ df = DataFrame (
629
+ np .random .randint (1 , 10 , size = (100 , 2 )), columns = ["a" , "b" ]
630
+ ).groupby ("a" )
631
+ axes = df .hist (bins = 12 , alpha = 0.5 , histtype = histtype )
632
+ for sub_axes in axes :
633
+ for ax in sub_axes [0 ]:
634
+ for patch in ax .patches :
635
+ assert patch .fill is expected
0 commit comments