distplot was deprecated in favour of displot.
The previous function had the option to draw a normal curve.
import seaborn as sns
import matplotlib.pyplot as plt
from scipy import stats
ax = sns.distplot(df.extracted, bins=40, kde=False, fit=stats.norm)
the fit=stats.norm
doesn't work with displot anymore. In the answer to this question, I see the approach to plot the normal later, however it is done on some random data averaged around 0.
seaborn.displot
is a figure-level plot where thekind
parameter specifies the approach. Whenkind='hist'
the parameters forseaborn.histplot
are available.seaborn.axisgrid.FacetGrid.map
expects dataframe column names, as such, to map the pdf ontoseaborn.displot
, the data needs to be in a dataframe.x_pdf
is calculated for eachaxes
:x0, x1 = p1.axes[0][0].get_xlim()
axes
are different for multiple Facets (sharex=False
), then there's not a way to getxlim
for eachaxes
within.map
.python 3.8.11
,pandas 1.3.2
,matplotlib 3.4.2
,seaborn 0.11.2
Single Facet
.map
can be usedSingle or Multiple Facets