Distribution plot

Seaborn basics

1 min read

Published Oct 7 2025, updated Aug 17 2026


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 snsimport 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 snsimport 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 snsimport 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 snsimport 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
© 2025 SimpleSteps.guide
AboutFAQPoliciesContact