# Seaborn Figure-Level vs Axes-Level Functions

> Seaborn figure-level vs axes-level functions: relplot, displot, catplot and lmplot return a FacetGrid, while scatterplot, histplot and boxplot draw on a Matplotlib Axes.

Source: https://www.pythoncharts.com/seaborn/seaborn-figure-level-vs-axes-level/ | Published: 2026-11-27 | Author: Alex Scott | Category: Seaborn | Tags: seaborn, figure-level, axes-level, FacetGrid, relplot, displot, catplot

Axes-level functions such as `sns.scatterplot()` draw on one Matplotlib `Axes` and return it. Figure-level functions such as `sns.relplot()` create their own figure, can split it into panels with `col=` and `row=`, and return a `FacetGrid`. That difference decides how you set the size, titles, and legend.

![Diagram mapping relplot to scatterplot and lineplot, displot to histplot, kdeplot and ecdfplot, catplot to the categorical plots, and lmplot to regplot](https://www.pythoncharts.com/seaborn/seaborn-figure-level-vs-axes-level/images/seaborn-figure-level-axes-level-diagram.png)

## Quick Example

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

# Sample data: weekly heights of 90 seedlings
rng = np.random.default_rng(66)
growth = {"Basil": 2.1, "Pepper": 1.6, "Tomato": 3.2}  # cm per week
rows = []
for species, rate in growth.items():
    for light, factor in [("Full sun", 1.0), ("Shade", 0.65)]:
        for plant in range(15):
            own_rate = rate * factor * rng.normal(1, 0.15)
            for week in range(1, 9):
                rows.append({"species": species, "light": light, "week": week,
                             "plant": f"{species}-{light}-{plant}",
                             "height": 3 + own_rate * week + rng.normal(0, 0.6)})
plants = pd.DataFrame(rows)
colors = {"Full sun": "#ca8a04", "Shade": "#1d4ed8"}
sns.set_theme(style="ticks")

# Axes-level: you make the figure, Seaborn draws on your Axes
fig, ax = plt.subplots(figsize=(8, 4.2))
sns.lineplot(data=plants, x="week", y="height", hue="light", palette=colors, ax=ax)
ax.set_title("All species")
plt.show()

# Figure-level: Seaborn makes the figure, with one panel per species
g = sns.relplot(data=plants, x="week", y="height", hue="light", palette=colors,
                kind="line", col="species", height=3.4, aspect=0.9)
plt.show()
```

![Single line chart of seedling height by week for full sun and shade, pooled across species](https://www.pythoncharts.com/seaborn/seaborn-figure-level-vs-axes-level/images/seaborn-axes-level-example.png)

![Three line charts, one each for basil, pepper, and tomato, comparing seedling height in full sun and shade](https://www.pythoncharts.com/seaborn/seaborn-figure-level-vs-axes-level/images/seaborn-figure-level-example.png)

The second call needed no `plt.subplots()` and no loop. The code targets Seaborn 0.13.

## Which Functions Are Which?

| Figure-level | `kind=` options | Axes-level equivalents |
|---|---|---|
| `relplot` | `"scatter"` (default), `"line"` | `scatterplot`, `lineplot` |
| `displot` | `"hist"` (default), `"kde"`, `"ecdf"` | `histplot`, `kdeplot`, `ecdfplot` (`rugplot` via `rug=True`) |
| `catplot` | `"strip"` (default), `"swarm"`, `"box"`, `"violin"`, `"boxen"`, `"point"`, `"bar"`, `"count"` | `stripplot`, `swarmplot`, `boxplot`, `violinplot`, `boxenplot`, `pointplot`, `barplot`, `countplot` |
| `lmplot` | none | `regplot` (plus `hue` and facets) |

`jointplot` and `pairplot` are also figure-level, but build a `JointGrid` or `PairGrid` with their own layouts. `heatmap` is axes-level, and `clustermap` is figure-level.

## The Practical Differences

| Task | Axes-level | Figure-level |
|---|---|---|
| Returns | `Axes` | `FacetGrid` |
| Draw into your own layout | `ax=` | Not supported |
| Size | `plt.subplots(figsize=(w, h))` | `height=` and `aspect=` |
| Small multiples | Write a loop | `col=`, `row=`, `col_wrap=` |
| Title | `ax.set_title()` | `g.figure.suptitle()`, `g.set_titles()` |
| Axis labels | `ax.set(xlabel=...)` | `g.set_axis_labels()` or `g.set()` |
| Legend position | Inside the Axes | Outside the grid |
| Save | `fig.savefig()` | `g.savefig()` |

## Set the Size

`height` is the height of **each panel** in inches, and `aspect` is the panel's width divided by its height. The figure grows as you add panels.

```python
g = sns.relplot(data=plants, x="week", y="height", col="species", kind="line",
                height=3, aspect=1.2)
print(g.figure.get_size_inches().round(1))
plt.show()
```

That prints `[10.8  3. ]`: three panels of 3 × 1.2 inches across. A legend outside the grid adds more width. Passing `figsize=` raises an error about an unexpected keyword argument (an `AttributeError` or `TypeError`, depending on the plot kind). The [catplot size guide](https://www.pythoncharts.com/seaborn/seaborn-catplot-aspect-ratio-figure-size/) has more examples.

## Why Is ax= Ignored?

A figure-level function has to create its own figure to lay out panels. If you pass `ax=` to `relplot`, `displot`, or `catplot`, Seaborn warns, for example `relplot is a figure-level function and does not accept the `ax` parameter`, and draws on a new figure. Your original subplot stays empty. `lmplot` and `pairplot` raise a `TypeError`.

Use the axes-level function to place charts in a grid you control:

```python
fig, axes = plt.subplots(1, 3, figsize=(12, 3.8))
final = plants[plants["week"] == 8]

sns.boxplot(data=final, x="species", y="height", hue="light", palette=colors, ax=axes[0])
sns.histplot(data=final, x="height", hue="light", palette=colors, element="step",
             legend=False, ax=axes[1])
sns.lineplot(data=plants, x="week", y="height", hue="species", palette=["#15803d", "#dc2626", "#7c3aed"],
             ax=axes[2])
for ax, title in zip(axes, ["Final height", "Distribution", "Growth by species"]):
    ax.set_title(title)
sns.despine()
fig.tight_layout()
plt.show()
```

![Three different Seaborn charts in one row of subplots: box plots of final height, a step histogram, and growth lines by species](https://www.pythoncharts.com/seaborn/seaborn-figure-level-vs-axes-level/images/seaborn-axes-level-subplots.png)

For unequal panel sizes, see [subplot_mosaic and GridSpec](https://www.pythoncharts.com/matplotlib/matplotlib-subplot-mosaic-gridspec/).

## Customize a FacetGrid

The grid object has methods that apply to every panel:

```python
g = sns.displot(data=plants[plants["week"] == 8], x="height", col="species",
                hue="light", palette=colors, element="step", binwidth=2,
                height=3.2, aspect=0.95)
g.set_titles("{col_name}")
g.set_axis_labels("Height at week 8 (cm)", "Seedlings")
g.refline(x=plants.loc[plants["week"] == 8, "height"].median(), color="#dc2626")
g.figure.suptitle("Where each species ends up", y=1.04)
sns.move_legend(g, "lower center", bbox_to_anchor=(0.45, -0.1), ncol=2, title=None)
plt.show()
```

![Faceted histograms of week 8 height by species with a red dashed line at the overall median, a figure title, and the legend below](https://www.pythoncharts.com/seaborn/seaborn-figure-level-vs-axes-level/images/seaborn-facetgrid-customize.png)

- `g.refline(x=..., y=...)` adds a reference line to every panel.
- `g.set(ylim=(0, 40))` passes settings to each `Axes`.
- `g.figure` is the Matplotlib figure.

## Reach a Single Panel

With one panel, use `g.ax`. With facets, `g.axes_dict` maps each column value to its `Axes`, and `g.axes` is a 2D array indexed `[row, col]`.

```python
g = sns.relplot(data=plants, x="week", y="height", col="species", kind="line",
                color="#15803d", height=3.2, aspect=0.9)
tomato = g.axes_dict["Tomato"]
tomato.set_facecolor("#fef2f2")
tomato.annotate("fastest", (6, plants.query("species == 'Tomato' and week == 6")["height"].mean()),
                xytext=(1.2, 24),
                arrowprops={"arrowstyle": "->", "color": "#111827"})
plt.show()
```

![Three growth panels with the tomato panel shaded pink and an arrow labeled fastest pointing at its line](https://www.pythoncharts.com/seaborn/seaborn-figure-level-vs-axes-level/images/seaborn-facetgrid-single-panel.png)

`g.ax` raises `AttributeError: Use the .axes attribute when facet variables are assigned` on a faceted grid.

## Draw Extra Layers with map_dataframe

`g.map_dataframe()` calls an axes-level function once per panel with that panel's rows, which lets you layer plots.

```python
g = sns.catplot(data=plants[plants["week"] == 8], x="light", y="height", col="species",
                kind="box", color="#e5e7eb", showfliers=False, height=3.4, aspect=0.8)
g.map_dataframe(sns.stripplot, x="light", y="height", order=["Full sun", "Shade"],
                color="#111827", size=3.5)
g.set_titles("{col_name}")
plt.show()
```

![Faceted box plots of week 8 height by light level with the individual seedlings drawn as dots on top](https://www.pythoncharts.com/seaborn/seaborn-figure-level-vs-axes-level/images/seaborn-facetgrid-map-dataframe.png)

Pass `order` explicitly so both layers place categories the same way.

## Which Should You Use?

- Use **figure-level** functions to explore data and to compare subsets in panels.
- Use **axes-level** functions when the chart is one part of a larger Matplotlib figure, or when you need exact control of the figure size.
- Building a loop over `plt.subplots()` to repeat one chart per category? Switch to `col=`.
- Calling `relplot` with no `col` or `row` is fine if you prefer its legend placement.

## Similar Topics

- [Adjust Aspect Ratio and Figure Size in a Seaborn catplot](https://www.pythoncharts.com/seaborn/seaborn-catplot-aspect-ratio-figure-size/)
- [How to Move the Legend in Seaborn](https://www.pythoncharts.com/seaborn/seaborn-move-legend/)
- [Matplotlib Figure vs Axes](https://www.pythoncharts.com/matplotlib/matplotlib-figure-vs-axes/)
