Reputation: 384
I have the following code:
sns.displot(data_df_cleaned, x='estimate_error', bins = [-30, -5, 5, 30, 80])
which plots the following simple histogram, but I want my y axis to report percentage. It is important that I do this with Seaborn, for which I couldn't find any answer in the documentation or stackoverflow.
Upvotes: 0
Views: 3054
Reputation: 384
sns.Displot
takes kind='hist'
as default, and if a parameter from sns.histplot
called stat
is set such that stat='probability'
, the y axis shows percentage instead of count. So the answer is:
sns.displot(data_df_cleaned, x='estimate_error', bins = [-30, -5, 5, 30, 80], stat='probability')
Upvotes: 2