For example, I have a dataframe:
data = {'1': [1, 1, 2,2,2,2,2, 3,2.5,2.5,1.5,2,2.5,2, 2, 3,1.5,2],
'2': [1,1,1,1,1,1,1,1,1,1,1,1,1,1,0, 0,0,0],
}
df = pd.DataFrame(data).T
df
I would like to draw a histogram in Seaborn,
import seaborn as sns
sns.histplot(data=df, x="1", hue='2',stat='probability')
Due to class 0 having few records, the bar is quite low (I want it's max height the same as class 1) even if I add a "stat" parameter of 'probability'.
It's because it's the "probability" out of total, is there another kind of "probability" exactly out of the hue category (0 and 1 here)?
question from:
https://stackoverflow.com/questions/65948859/is-there-a-way-to-show-the-probability-within-hue-category-in-seaborn-histogram