Joint plot

Seaborn basics

2 min read

Published Oct 7 2025


24
0
0
0

ChartsGraphsMatplotlibNumPyPandasPythonSeabornVisualisation

seaborn.jointplot() visualises the relationship between two variables along with their marginal distributions.

It combines:

  • Scatterplot / Hexbin / KDE / Regression in the centre, and
  • Histograms or density plots on the top and right axes (marginals).

It’s figure-level, meaning it creates its own figure with multiple axes.


Syntax:

sns.jointplot(
    data=None,
    *,
    x=None,
    y=None,
    hue=None,
    kind="scatter",
    palette=None,
    height=6,
    ratio=5,
    marginal_ticks=False,
    joint_kws=None,
    marginal_kws=None,
    dropna=True,
    space=0.2,
    xlim=None,
    ylim=None,
    color=None,
    **kwargs
)

Parameters:

  • data = DataFrame containing the data
  • x, y = Numeric variables for the joint plot
  • hue = Grouping variable to colour points
  • kind = Type of central plot: "scatter", "kde", "hist", "hex", "reg"
  • palette = Colour palette for hue
  • height = Size (inches) of the joint plot (square)
  • ratio = Size ratio of joint axes to marginal axes
  • marginal_ticks = Show tick marks on marginal plots
  • joint_kws = Keyword arguments for the central plot
  • marginal_kws = Keyword arguments for the marginal plots
  • dropna = Drop missing values
  • space = Space between joint and marginal axes
  • xlim, ylim = Limits for x and y axes
  • color = Colour of points or lines if hue is not used




Basic example

import seaborn as sns
import matplotlib.pyplot as plt

tips = sns.load_dataset("tips")

sns.jointplot(data=tips, x="total_bill", y="tip")
plt.show()

Central scatterplot of total_bill vs tip, Marginal histograms show distributions of each variable


seaborn joint plot basic example





Central plot type 'reg'

import seaborn as sns
import matplotlib.pyplot as plt

tips = sns.load_dataset("tips")

sns.jointplot(data=tips, x="total_bill", y="tip", kind="reg")
plt.show()

seaborn joint plot kind reg example





Central plot type 'kde'

import seaborn as sns
import matplotlib.pyplot as plt

tips = sns.load_dataset("tips")

sns.jointplot(data=tips, x="total_bill", y="tip", kind="kde", fill=True)
plt.show()

seaborn joint plot kind kde example





Central plot type 'hex'

import seaborn as sns
import matplotlib.pyplot as plt

tips = sns.load_dataset("tips")

sns.jointplot(data=tips, x="total_bill", y="tip", kind="hex", gridsize=25)
plt.show()

seaborn joint plot kind hex example





Central plot type 'hist'

import seaborn as sns
import matplotlib.pyplot as plt

tips = sns.load_dataset("tips")

sns.jointplot(data=tips, x="total_bill", y="tip", kind="hist")
plt.show()

seaborn joint plot kind hist example





Add hue (categorical colouring)

import seaborn as sns
import matplotlib.pyplot as plt

tips = sns.load_dataset("tips")

sns.jointplot(data=tips, x="total_bill", y="tip", hue="sex", kind="scatter", palette="Set1")
plt.show()

Colours points by category. Marginal distributions also coloured by hue.


seaborn joint plot hue example





Customise marginals

import seaborn as sns
import matplotlib.pyplot as plt

tips = sns.load_dataset("tips")

sns.jointplot(
    data=tips,
    x="total_bill",
    y="tip",
    kind="scatter",
    marginal_kws=dict(bins=20, fill=True, alpha=0.5)
)
plt.show()

Adjust histogram bins, fill, transparency, etc.


seaborn joint plot customise marginals example





Control central plot appearance

import seaborn as sns
import matplotlib.pyplot as plt

tips = sns.load_dataset("tips")

sns.jointplot(
    data=tips,
    x="total_bill",
    y="tip",
    kind="scatter",
    joint_kws=dict(alpha=0.6, s=50, color="green")
)
plt.show()

Change point size (s), transparency (alpha), and coluor.


seaborn joint plot customise central example





Adjust size and margins

import seaborn as sns
import matplotlib.pyplot as plt

tips = sns.load_dataset("tips")

sns.jointplot(data=tips, x="total_bill", y="tip", height=8, ratio=2)
plt.show()

height → size of square joint plot, ratio → relative size of joint axes vs marginal axes


seaborn joint plot ratio example
© 2025 SimpleSteps.guide
AboutFAQPoliciesContact