Skip to content

Instantly share code, notes, and snippets.

@mwaskom
Last active July 14, 2024 05:46
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
Raw
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@Nyantahi
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) 

@fanel27
Copy link

fanel27 commented Feb 18, 2024

Thank you for the explanations!

@eluseful
Copy link

eluseful commented Mar 4, 2024

Thanks, good stuff!

@Andres-Abi
Copy link

Thanks, is perfect

@Kushoza8
Copy link

Good Explaination

@vishwajeet-yaduraj
Copy link

cool, now I know what to do lol.

@abirmazumdar03
Copy link

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

@win7
Copy link

win7 commented Jun 12, 2024

Thanks, it was a great...

@Anwarhossen21
Copy link

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

@abdme777
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.

@Nirvana2211
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