Seaborn and Matplotlib aren't rivals — they're layers. Understanding the division of labour tells you which to reach for and how to combine them.
The division of labour
| Use Seaborn for | Use Matplotlib for |
|---|---|
| Statistical charts fast (dist, box, regression) | Full control over every element |
| Grouping/colouring by a column (hue) | Custom/uncommon chart types |
| Attractive defaults | Fine-tuning titles, ticks, annotations |
| DataFrame → chart in one line | Non-tabular or low-level drawing |
Working together
Seaborn draws onto Matplotlib Axes, so you customise the result with everything you know from Matplotlib:
fig, ax = plt.subplots(figsize=(8, 5))sns.boxplot(data=tips, x="day", y="total_bill", ax=ax) # draw with Seabornax.set_title("Bill by day") # refine with Matplotlibax.set_ylabel("Total bill ($)")ax.spines[["top", "right"]].set_visible(False)
Key takeaways
- 01Seaborn and Matplotlib are layers, not rivals.
- 02Seaborn: fast statistical charts with grouping and good defaults.
- 03Matplotlib: full control, custom chart types, fine-tuning.
- 04Draw with Seaborn (pass ax=), then refine with Matplotlib.
