@@ -727,7 +727,11 @@ def _df_bar_subplot_checker(df_bar_data, df_bar_df, subplot_data_df, subplot_col
727
727
].reset_index ()
728
728
for i in range (len (subplot_columns ))
729
729
]
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 )
731
735
732
736
for i in range (len (subplot_columns )):
733
737
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
743
747
tm .assert_series_equal (
744
748
height_iter , expected_total_height , check_names = False , check_dtype = False
745
749
)
746
-
747
750
else :
748
751
# Checks each preceding bar ends where the next one starts
749
752
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
818
821
)
819
822
820
823
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
+
821
836
def test_plot_bar_label_count_default ():
822
837
df = DataFrame (
823
838
[(30 , 10 , 10 , 10 ), (20 , 20 , 20 , 20 ), (10 , 30 , 30 , 10 )], columns = list ("ABCD" )
0 commit comments