Multiple relational plots

Seaborn basics

1 min read

Published Oct 7 2025, updated Aug 17 2026


24
0
0
0

ChartsGraphsMatplotlibNumPyPandasPythonSeabornVisualisation

seaborn.relplot() is a figure-level function for creating relational plots — it’s basically a wrapper around sns.scatterplot() and sns.lineplot() that allows faceting (i.e., multiple subplots for different subsets of data).

It helps you visualise relationships between variables and how they change across categories.


Syntax:

sns.relplot(    data=None,    x=None,    y=None,    hue=None,    style=None,    size=None,    col=None,    row=None,    kind='scatter',    palette=None,    markers=True,    sizes=None,    col_wrap=None,    height=5,    aspect=1,    facet_kws=None,    **kwargs)

Parameters:

  • data = DataFrame with your data
  • x, y = Variables to plot on axes
  • hue = Colour by variable
  • style = Marker or line style by variable
  • size = Marker/line size by variable
  • col, row = Create subplots (facets) across columns or rows
  • kind = "scatter" (default) or "line"
  • palette = Colour palette
  • col_wrap = Wrap facet columns onto multiple rows
  • height = Height (in inches) of each facet
  • aspect = Aspect ratio (width/height) of each facet




Basic example (scatter)

import seaborn as snsimport matplotlib.pyplot as plt​data = sns.load_dataset("penguins")​sns.relplot(    data=data,    x="bill_length_mm",    y="bill_depth_mm",    kind="scatter")plt.show()

Creates a simple scatter plot of bill length vs bill depth.


seaborn relational plot basic example





Faceting with col and row

import seaborn as snsimport matplotlib.pyplot as plt​data = sns.load_dataset("penguins")​sns.relplot(    data=data,    x="bill_length_mm",    y="bill_depth_mm",    hue="species",    col="island",    kind="scatter")plt.show()

Creates a separate plot for each island.


seaborn relational plot faceting col row example





Faceting in grid (row + col)

import seaborn as snsimport matplotlib.pyplot as plt​data = sns.load_dataset("penguins")​sns.relplot(    data=data,    x="bill_length_mm",    y="bill_depth_mm",    hue="species",    col="island",    row="sex",    kind="scatter")plt.show()

Subplots arranged by island (columns) and sex (rows).


seaborn relational plot faceting grid example





Faceting line chart

import seaborn as snsimport matplotlib.pyplot as plt​fmri = sns.load_dataset("fmri")​sns.relplot(    data=fmri,    x="timepoint",    y="signal",    hue="event",    col="region",    kind="line",    height=4,    aspect=1.2)plt.show()

Makes a grid of line plots, one for each brain region.


seaborn relational plot faceting line example
© 2025 SimpleSteps.guide
AboutFAQPoliciesContact