Distribution plot

Seaborn basics

1 min read

Published Oct 7 2025


24
0
0
0

ChartsGraphsMatplotlibNumPyPandasPythonSeabornVisualisation

seaborn.displot() is a figure-level function for visualising distributions of one or two numeric variables.

It can create:

  • Histograms
  • Kernel Density Estimates (KDE)
  • ECDF plots
  • Faceted grids (multiple subplots by category)

It acts as a wrapper around:

  • sns.histplot()
  • sns.kdeplot()
  • sns.ecdfplot()

and provides additional faceting (subplot) capabilities.


Syntax:

sns.displot(
    data=None,
    *,
    x=None,
    y=None,
    hue=None,
    row=None,
    col=None,
    kind="hist",
    stat="count",
    bins="auto",
    binwidth=None,
    discrete=False,
    kde=False,
    fill=True,
    palette=None,
    multiple="layer",
    common_norm=True,
    common_bins=True,
    aspect=None,
    height=5,
    facet_kws=None,
    **kwargs
)

Parameters:

  • data = DataFrame containing the data
  • x, y = Variables to plot
  • hue = Adds colour-coded subgroups
  • row, col = Create multiple subplots (facets)
  • kind = "hist", "kde", or "ecdf"
  • stat = What the bar/curve height represents: "count", "probability", "percent", "density"
  • bins, binwidth = Control histogram binning
  • multiple = How hue groups are displayed ("layer", "stack", "dodge", "fill")
  • common_norm = Normalise groups together or separately
  • palette = Colour scheme
  • aspect = Width-to-height ratio of each facet
  • height = Height of each facet (in inches)




Basic example

import seaborn as sns
import matplotlib.pyplot as plt

tips = sns.load_dataset("tips")

sns.displot(data=tips, x="total_bill")
plt.show()

Creates a histogram of total_bill. Equivalent to sns.histplot(x="total_bill"), but as a figure-level plot.


seaborn dis plot basic example





Facet by column

import seaborn as sns
import matplotlib.pyplot as plt

tips = sns.load_dataset("tips")

sns.displot(data=tips, x="total_bill", col="day")
plt.show()

One subplot for each day.


seaborn dis plot col example





Facet by row and column

import seaborn as sns
import matplotlib.pyplot as plt

tips = sns.load_dataset("tips")

sns.displot(data=tips, x="total_bill", col="day", row="sex")
plt.show()

Creates a grid of subplots by both day (columns) and sex (rows).


seaborn dis plot row col example





Customise facet appearance

import seaborn as sns
import matplotlib.pyplot as plt

tips = sns.load_dataset("tips")

sns.displot(
    data=tips,
    x="total_bill",
    col="day",
    hue="sex",
    kind="kde",
    fill=True,
    height=4,
    aspect=1.2,
    palette="coolwarm"
)
plt.show()

Adjusts subplot size (height) and shape (aspect) Adds colour-coded KDEs within each facet


seaborn dis plot style example

Products from our shop

Docker Cheat Sheet - Print at Home Designs

Docker Cheat Sheet - Print at Home Designs

Docker Cheat Sheet Mouse Mat

Docker Cheat Sheet Mouse Mat

Docker Cheat Sheet Travel Mug

Docker Cheat Sheet Travel Mug

Docker Cheat Sheet Mug

Docker Cheat Sheet Mug

Vim Cheat Sheet - Print at Home Designs

Vim Cheat Sheet - Print at Home Designs

Vim Cheat Sheet Mouse Mat

Vim Cheat Sheet Mouse Mat

Vim Cheat Sheet Travel Mug

Vim Cheat Sheet Travel Mug

Vim Cheat Sheet Mug

Vim Cheat Sheet Mug

SimpleSteps.guide branded Travel Mug

SimpleSteps.guide branded Travel Mug

Developer Excuse Javascript - Travel Mug

Developer Excuse Javascript - Travel Mug

Developer Excuse Javascript Embroidered T-Shirt - Dark

Developer Excuse Javascript Embroidered T-Shirt - Dark

Developer Excuse Javascript Embroidered T-Shirt - Light

Developer Excuse Javascript Embroidered T-Shirt - Light

Developer Excuse Javascript Mug - White

Developer Excuse Javascript Mug - White

Developer Excuse Javascript Mug - Black

Developer Excuse Javascript Mug - Black

SimpleSteps.guide branded stainless steel water bottle

SimpleSteps.guide branded stainless steel water bottle

Developer Excuse Javascript Hoodie - Light

Developer Excuse Javascript Hoodie - Light

Developer Excuse Javascript Hoodie - Dark

Developer Excuse Javascript Hoodie - Dark

© 2025 SimpleSteps.guide
AboutFAQPoliciesContact