How to Add and Change Titles in Seaborn FacetGrid, relplot, and catplot

Add an overall title to a Seaborn FacetGrid, rewrite the panel titles with set_titles, title each panel separately, and fix titles that overlap or get cut off.

To add one title above a whole Seaborn grid, use g.figure.suptitle("My title"). To change the title above each panel, use g.set_titles("{col_name}"). Both work on anything that returns a FacetGrid: relplot(), catplot(), displot(), and lmplot().

Quick Example

import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import seaborn as sns

# Sample data: weekly bread sales at three bakery locations over two years
rng = np.random.default_rng(81)
rows = []
for shop, base, up in [("Harbor", 310, 1.18), ("Old Town", 420, 1.11), ("Station", 260, 1.05)]:
    for year, growth in [(2025, 1.0), (2026, up)]:
        for week in range(1, 53):
            season = 1 + 0.18 * np.cos(2 * np.pi * (week - 50) / 52)
            loaves = base * growth * season + rng.normal(0, 18)
            rows.append((shop, year, week, round(loaves)))
sales = pd.DataFrame(rows, columns=["shop", "year", "week", "loaves"])

sns.set_theme(style="whitegrid")
g = sns.relplot(data=sales, x="week", y="loaves", hue="year", col="shop",
                kind="line", palette=["#a8a29e", "#b45309"], height=3.2, aspect=1)

g.set_titles("{col_name}", size=12, fontweight="bold")   # one per panel
g.figure.suptitle("Weekly loaves sold by location", fontsize=15)  # whole grid
g.figure.subplots_adjust(top=0.84)                       # make room for it
g.set_axis_labels("Week of year", "Loaves")
plt.show()

Three Seaborn line panels titled Harbor, Old Town, and Station under the heading Weekly loaves sold by location

The code targets Seaborn 0.13.

Add a Title to the Whole Grid

A FacetGrid holds a Matplotlib figure in g.figure, and suptitle() titles that figure. The grid fills the figure completely, so a new title lands on top of the panel titles unless you make room. There are two ways to do it.

g = sns.catplot(data=sales, x="year", y="loaves", col="shop", kind="violin",
                color="#fcd34d", height=3, aspect=0.9)

# Option 1: shrink the panels to leave the top 16% free
g.figure.subplots_adjust(top=0.84)
g.figure.suptitle("Weekly sales spread by year")
plt.show()

Seaborn violin plot panels for three shops with one title above them all

The second option is to place the title above the figure with y greater than 1:

g = sns.catplot(data=sales, x="year", y="loaves", col="shop", kind="violin",
                color="#fcd34d", height=3, aspect=0.9)
g.figure.suptitle("Weekly sales spread by year", y=1.04)
g.savefig("sales.png", dpi=150)  # the saved image includes the title
plt.show()

y=1.04 is the quickest fix in Jupyter and when saving, because both crop to the drawn content (g.savefig() uses bbox_inches="tight" by default). A plain plt.show() window, or g.figure.savefig() without that argument, cuts the title off. subplots_adjust(top=...) works everywhere.

g.set(title="...") is not a grid title. It gives every panel the same title, replacing the names that tell them apart.

Change the Panel Titles with set_titles

By default each panel is titled variable = value, such as shop = Harbor. set_titles() takes a format string with these fields:

Field Value
{col_name} The panel's column category
{col_var} The column variable's name
{row_name} The panel's row category
{row_var} The row variable's name
g = sns.displot(data=sales, x="loaves", col="shop", color="#b45309",
                height=3, aspect=1)
g.set_titles("{col_name} bakery")
plt.show()

Histogram panels titled Harbor bakery, Old Town bakery, and Station bakery

Format specifiers work too, so "{col_name:.1f} kg" rounds a numeric category. Using {row_name} on a grid that has no row= raises KeyError: 'row_name'.

Titles with Both Rows and Columns

With row= and col=, each default title carries both values, separated by a |. Shorten it by including only the names:

sales["half"] = np.where(sales["week"] <= 26, "Jan to Jun", "Jul to Dec")

g = sns.displot(data=sales, x="loaves", row="half", col="shop",
                color="#0e7490", height=2.4, aspect=1.2)
g.set_titles("{col_name}, {row_name}")
plt.show()

Two by three grid of histograms with titles that combine shop name and half of the year

Put Row Titles in the Margin

margin_titles=True writes column names across the top and row names down the right side. Pass it through facet_kws in relplot, displot, and lmplot; catplot accepts margin_titles=True directly.

In this mode set_titles() ignores a plain template. Use col_template and row_template:

g = sns.displot(data=sales, x="loaves", row="half", col="shop",
                color="#0e7490", height=2.4, aspect=1.2,
                facet_kws={"margin_titles": True})
g.set_titles(col_template="{col_name}", row_template="{row_name}", size=12)
plt.show()

Histogram grid with shop names across the top and half-year labels rotated down the right side

Write a Different Title for Each Panel

When the titles can't come from one template, loop over g.axes_dict. It maps each category to its Axes. This example puts the 2026 growth for each shop in its title.

totals = sales.pivot_table(index="shop", columns="year", values="loaves", aggfunc="sum")
growth = totals[2026] / totals[2025] - 1

g = sns.relplot(data=sales, x="week", y="loaves", hue="year", col="shop",
                kind="line", palette=["#a8a29e", "#b45309"], height=3.2, aspect=1)
for shop, ax in g.axes_dict.items():
    ax.set_title(f"{shop}: {growth[shop]:+.1%} in 2026")
plt.show()

Line panels whose titles give each shop's percentage growth in 2026

With both row and col, the keys are tuples: for (row, col), ax in g.axes_dict.items(). The same loop is the way to wrap long titles with textwrap.fill().

Style and Left-Align Panel Titles

set_titles() passes extra keyword arguments to Matplotlib, so size, color, and fontweight work. loc="left" needs one extra step. It writes a second, left-aligned title and leaves the default centered one in place, so clear the centered titles first.

g = sns.displot(data=sales, x="loaves", col="shop", color="#b45309",
                height=3, aspect=1)
g.set_titles("")  # remove the centered titles
g.set_titles("{col_name}", loc="left", size=13, color="#7c2d12", fontweight="bold")
plt.show()

Histogram panels with bold brown left-aligned shop names

Remove the Panel Titles

g.set_titles("") blanks them. Only do that when something else identifies the panels, such as a label drawn inside each one, as in the Seaborn ridge plot.

Single-Panel Grids, pairplot, and jointplot

If you call relplot() or catplot() without col or row, there is only one panel. g.set(title="...") or g.ax.set_title("...") titles it, with no spacing adjustment.

sns.pairplot() returns a PairGrid, which has no set_titles(). Use g.figure.suptitle("...", y=1.02). The same works for the JointGrid from sns.jointplot().

Which Method Should I Use?

Goal Method
One title for the whole grid g.figure.suptitle()
Rename all panels from their categories g.set_titles("{col_name}")
Row names on the right edge margin_titles=True plus row_template and col_template
Unique text per panel Loop over g.axes_dict
Title on a single-panel grid g.set(title=...)
Title on an axes-level plot such as scatterplot ax.set_title()

The last row is the split between figure-level and axes-level functions.

Similar Topics