Skip to content

Instantly share code, notes, and snippets.

Last active July 21, 2024 17:06
Show Gist options
  • Save mwaskom/de44147ed2974457ad6372750bbe5751 to your computer and use it in GitHub Desktop.
Save mwaskom/de44147ed2974457ad6372750bbe5751 to your computer and use it in GitHub Desktop.
A guide to replacing the deprecated `seaborn.distplot` function.
Display the source blob
Display the rendered blob
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Copy link

Thank you. That was useful.

Copy link

This is very helpful. Thank you.

Copy link

Nyantahi commented Jan 6, 2024

getting unexpected keyword argument 'hist' when I try to disable histogram, when I am trying to just show density curve

ax1 = sns.displot(df['price'], hist=False, color="r", label="Actual Value")
sns.displot(Yhat, hist=False, color="b", label="Fitted Values" , ax=ax1)

1195 func = getattr(self, f"set_{k}", None) 1196 if not callable(func): -> 1197 raise AttributeError( 1198 errfmt.format(cls=type(self), prop_name=k)) 1199 ret.append(func(v)) 1200 if ret:

AttributeError: Rectangle.set() got an unexpected keyword argument 'hist'

You have to use kind="kde" and remove hist="False" like the code below:

ax1 = sns.displot(df['price'], kind="kde", color="r", label="Actual Value")
sns.displot(Y_hat, color="b", kind="kde", label="Fitted Values", ax=ax1) 

Copy link

fanel27 commented Feb 18, 2024

Thank you for the explanations!

Copy link

eluseful commented Mar 4, 2024

Thanks, good stuff!

Copy link

Thanks, is perfect

Copy link

Good Explaination

Copy link

cool, now I know what to do lol.

Copy link

Thank you sir...This notebook was a great help

Copy link

win7 commented Jun 12, 2024

Thanks, it was a great...

Copy link

abdme777 commented Jul 4, 2024

Hello, thanks for your guidness. I try your help untill in[12] but i get this message name 'df ' is not defined. please help to solve this problem. my python version is 3.11.

can your share your code to fix the error

I guess you figured out that df is just the variable Mr. Waskom used for his dataset.

Copy link

Not sure who manages this webpage , but this still refers to distplot

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment