Skip to content

Tag: seaborn

Ordering a stacked histplot based on total counts

I have a dataframe which results from: Then, df_grouped is something like: A B count A_1 B_1 10 A_1 B_2 51 A_1 B_3 25 A_1 B_4 12 A_1 B_5 2 A_2 B_1 19 A_2 B_3 5 A_3 B_5 18 A_3 B_4 33 A_3 B_5 44 A_4 B_1 29 A_5 B_2 32 I have plotted a seaborn.histplot using the following code: