Using distplot to plot a histogram
sns.distplot(a, color="red", label="100% Equities")
and running this under Seaborn version 0.11 or greater produces the following warning:
FutureWarning:
distplot
is a deprecated function and will be removed in a future version. Please adapt your code to use eitherdisplot
(a figure-level function with similar flexibility) orhistplot
(an axes-level function for histograms). warnings.warn(msg, FutureWarning)
Using displot as a direct replacement (simply changing the function name from distplot to displot) does not produce the same histogram.
What is the replacement code?
Use
histplot
instead of distplot
kde=True, stat="density", linewidth=0
So:
sns.histplot(a, color="red", label="100% Equities", kde=True, stat="density", linewidth=0)
replaces
sns.distplot(a, color="red", label="100% Equities")