Skip to main content
Albero Academy

Figure-level vs Axes-level

The most important Seaborn distinction — and which functions to use.

Foundations10 min

Seaborn functions come in two flavours, and knowing the difference is the key to using the library well. Axes-level functions draw on a single Axes; figure-level functions manage their own whole figure and can create a grid of panels.

Axes-level functions

These draw on one Axes and accept ax= — they slot into Matplotlib subplots:

axes-level: scatterplot, boxplot, histplot…
fig, ax = plt.subplots()
sns.scatterplot(data=tips, x="total_bill", y="tip", ax=ax) # one Axes
# also: lineplot, histplot, kdeplot, boxplot, violinplot, barplot, heatmap

Figure-level functions

These own the whole figure and can split data into a grid via col=/row= (faceting):

figure-level: relplot, displot, catplot
sns.relplot(data=tips, x="total_bill", y="tip",
col="time", hue="smoker") # one panel per 'time'
# relplot ↔ scatter/line, displot ↔ hist/kde, catplot ↔ box/violin/bar…
Figure-levelWraps these axes-level
relplotscatterplot, lineplot
displothistplot, kdeplot, ecdfplot
catplotboxplot, violinplot, barplot, stripplot…

Key takeaways

  1. 01Axes-level functions (scatterplot, boxplot…) draw on one Axes and accept ax=.
  2. 02Figure-level functions (relplot, displot, catplot) own the whole figure and can facet with col=/row=.
  3. 03Figure-level functions return a FacetGrid — you can't pass ax= to them.
  4. 04Use axes-level in your own subplots; figure-level for automatic multi-panel grids.

Finished this chapter?

Mark it complete to track your progress through Seaborn.