Seaborn's colour palettes are a core strength. Choosing the right type of palette for your data — like colormaps in Matplotlib — is what makes a chart clear rather than misleading.
The three types
| Palette type | Use for | Examples |
|---|---|---|
| Qualitative | Distinct categories | deep, muted, Set2, tab10 |
| Sequential | Ordered low→high | viridis, rocket, mako, Blues |
| Diverging | Meaningful midpoint | coolwarm, vlag, icefire |
sns.set_palette("Set2") # default for all chartssns.barplot(data=tips, x="day", y="tip", palette="muted") # per chartsns.color_palette("viridis", as_cmap=True) # a colormap for heatmapssns.color_palette("husl", 8) # 8 evenly-spaced distinct hues
Key takeaways
- 01Qualitative palettes (deep, Set2) distinguish categories.
- 02Sequential palettes (viridis, rocket) encode ordered magnitude.
- 03Diverging palettes (coolwarm, vlag) show deviation from a midpoint.
- 04set_palette sets a global default; palette= sets per-chart; prefer colour-blind-safe options.
