Skip to content

Instantly share code, notes, and snippets.

@mwaskom
Last active June 2, 2026 21:48
Show Gist options
  • Select an option

  • Save mwaskom/de44147ed2974457ad6372750bbe5751 to your computer and use it in GitHub Desktop.

Select an option

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.

ghost commented May 30, 2025

Copy link
Copy Markdown

Thank you for this update

@Prakritish-bhattacharya

Copy link
Copy Markdown

sns.distplot(df['total_bill'])
after run it , I get same type of err
C:\Users\HP\AppData\Local\Temp\ipykernel_14544\1285936593.py:1: UserWarning:

distplot is a deprecated function and will be removed in seaborn v0.14.0.

Please adapt your code to use either displot (a figure-level function with
similar flexibility) or histplot (an axes-level function for histograms).

For a guide to updating your code to use the new functions, please see
https://gist.github.com/mwaskom/de44147ed2974457ad6372750bbe5751

sns.distplot(df['total_bill'])
***but explanation is too good

@wasiqnafay

Copy link
Copy Markdown

**

  • min_to_sec_urdu (2)

** @ @ #

@wasiqnafay

Copy link
Copy Markdown

  • #@ludo-game-board-full-board-board-game-games-board-game-free-printable-ludo-board

@wasiqnafay

Copy link
Copy Markdown

you are dogs

@bcov77

bcov77 commented Jun 2, 2026

Copy link
Copy Markdown

Perhaps I'm posting this for myself, but here's a wrapper for the final example above showing how to replicate distplot()

def my_distplot(data=None, **kwargs):
    kwargs.setdefault("kde", True)
    kwargs.setdefault("stat", "density")
    kwargs.setdefault("kde_kws", dict(cut=3))
    kwargs.setdefault("alpha", .4)
    kwargs.setdefault("edgecolor", None)
    return sns.histplot(data, **kwargs)

edgecolor is set slightly differently from the example because distplot by default doesn't have edges (the example gives it white opaque edges)

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