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:
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):
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-level | Wraps these axes-level |
|---|---|
relplot | scatterplot, lineplot |
displot | histplot, kdeplot, ecdfplot |
catplot | boxplot, violinplot, barplot, stripplot… |
Key takeaways
- 01Axes-level functions (scatterplot, boxplot…) draw on one Axes and accept ax=.
- 02Figure-level functions (relplot, displot, catplot) own the whole figure and can facet with col=/row=.
- 03Figure-level functions return a FacetGrid — you can't pass ax= to them.
- 04Use axes-level in your own subplots; figure-level for automatic multi-panel grids.
