@@ -727,7 +727,11 @@ def _df_bar_subplot_checker(df_bar_data, df_bar_df, subplot_data_df, subplot_col
727727 ].reset_index ()
728728 for i in range (len (subplot_columns ))
729729 ]
730- expected_total_height = df_bar_df .loc [:, subplot_columns ].sum (axis = 1 )
730+
731+ if len (subplot_columns ) == 1 :
732+ expected_total_height = df_bar_df .loc [:, subplot_columns [0 ]]
733+ else :
734+ expected_total_height = df_bar_df .loc [:, subplot_columns ].sum (axis = 1 )
731735
732736 for i in range (len (subplot_columns )):
733737 sliced_df = subplot_sliced_by_source [i ]
@@ -743,7 +747,6 @@ def _df_bar_subplot_checker(df_bar_data, df_bar_df, subplot_data_df, subplot_col
743747 tm .assert_series_equal (
744748 height_iter , expected_total_height , check_names = False , check_dtype = False
745749 )
746-
747750 else :
748751 # Checks each preceding bar ends where the next one starts
749752 next_start_coord = subplot_sliced_by_source [i + 1 ]["y_coord" ]
@@ -818,6 +821,18 @@ def test_bar_2_subplots_1_triple_stacked(df_bar_data, df_bar_df, subplot_divisio
818821 )
819822
820823
824+ def test_bar_subplots_stacking_bool (df_bar_data , df_bar_df ):
825+ subplot_division = [("A" ), ("B" ), ("C" ), ("D" )]
826+ ax = df_bar_df .plot (subplots = True , kind = "bar" , stacked = True )
827+ subplot_data_df_list = _df_bar_xyheight_from_ax_helper (
828+ df_bar_data , ax , subplot_division
829+ )
830+ for i in range (len (subplot_data_df_list )):
831+ _df_bar_subplot_checker (
832+ df_bar_data , df_bar_df , subplot_data_df_list [i ], subplot_division [i ]
833+ )
834+
835+
821836def test_plot_bar_label_count_default ():
822837 df = DataFrame (
823838 [(30 , 10 , 10 , 10 ), (20 , 20 , 20 , 20 ), (10 , 30 , 30 , 10 )], columns = list ("ABCD" )
0 commit comments