Skip to main content
Albero Academy

relplot & Faceting

Split relational plots into a grid of panels by category.

Relational Plots9 min

sns.relplot is the figure-level version of scatter/line. Its superpower is faceting: split the data into a grid of small panels — one per category — so you compare subgroups side by side.

Faceting with col/row

small multiples
sns.relplot(
data=tips, x="total_bill", y="tip",
kind="scatter", # or "line"
col="time", # a column of panels per 'time'
row="sex", # a row of panels per 'sex'
hue="smoker",
)

Why facet?

Key takeaways

  1. 01relplot is the figure-level scatter/line — choose with kind="scatter"/"line".
  2. 02col= and row= split data into a grid of comparable panels (faceting).
  3. 03col_wrap wraps many panels; shared axes make groups comparable.
  4. 04relplot returns a FacetGrid, so customise via the returned object.

Finished this chapter?

Mark it complete to track your progress through Seaborn.