Seaborn Tutorial: A Guide to Statistical Charts in Python
A map of the Seaborn tutorials: which function to use, distributions, categories, relationships, heatmaps, facets, themes, and saving.
Seaborn draws statistical charts from a pandas DataFrame: pass data= and name the columns for x, y and hue, as in sns.scatterplot(data=df, x="price", y="sales", hue="region"). It is built on Matplotlib, so you can adjust the result with Matplotlib methods. These tutorials are grouped by task, and newer ones are written for Seaborn 0.13.

Quick Example
import matplotlib.pyplot as plt
import pandas as pd
import seaborn as sns
df = pd.DataFrame({
"week": list(range(1, 9)) * 2,
"plan": ["Free"] * 8 + ["Paid"] * 8,
"signups": [120, 132, 128, 151, 160, 158, 175, 190,
40, 46, 55, 58, 71, 80, 86, 99],
})
sns.set_theme(style="whitegrid")
fig, ax = plt.subplots(figsize=(7, 4.5))
sns.lineplot(data=df, x="week", y="signups", hue="plan", marker="o", ax=ax)
ax.set_title("Weekly Signups by Plan")
plt.show()

Where Should I Start With Seaborn?
Which Seaborn Plot Should I Use?
To choose by appearance, browse the Python Chart Gallery.
Customize Seaborn Charts
Should I Use Seaborn, Matplotlib, or the Objects Interface?
| Choose |
When |
| Seaborn functions |
Your data is in a DataFrame and you want grouping, aggregation or intervals handled for you |
| Matplotlib |
You need precise control or a chart Seaborn doesn't provide |
seaborn.objects |
You like building a chart in layers of marks, stats and moves |
| Plotly |
Readers need to hover, zoom or filter |
Common Seaborn Problems
| Problem |
Fix |
Details |
catplot ignores figsize |
Use height and aspect |
catplot size |
A figure-level function ignores ax= |
Use the axes-level version, such as histplot for displot |
Figure vs axes level |
| The legend covers the data |
sns.move_legend(ax, "upper left", bbox_to_anchor=(1, 1)) |
Move the legend |
| The grid title overlaps the panels |
g.figure.suptitle("Title", y=1.02) |
FacetGrid titles |
| "Points cannot be placed" warning |
Reduce size, widen the figure or use stripplot |
Beeswarm plots |
The ci parameter is deprecated |
Use errorbar |
Confidence bands |
Similar Topics