Skill Tracer
Skills › Scientific Agent Skills › seaborn › palettes_and_theming.md

palettes_and_theming.md

112 lines · skills/seaborn/references/palettes_and_theming.md at 5f2bc03

Open on GitHub
1# Color Palettes, Theming, and Aesthetics
2
3Qualitative, sequential, and diverging palettes, colorblind-safe choices, and theme,
4context, and style control.
5

Color Palettes, Theming, and Aesthetics

Qualitative, sequential, and diverging palettes, colorblind-safe choices, and theme, context, and style control.

Raw lines 1 to 5
6## Color Palettes
7
8Seaborn provides carefully designed color palettes for different data types:
9

Color Palettes

Seaborn provides carefully designed color palettes for different data types:

Raw lines 6 to 9
10### Qualitative Palettes (Categorical Data)
12Distinguish categories through hue variation:
13- `"deep"` - Default, vivid colors
14- `"muted"` - Softer, less saturated
15- `"pastel"` - Light, desaturated
16- `"bright"` - Highly saturated
17- `"dark"` - Dark values
18- `"colorblind"` - Designed to improve distinction for common color vision deficiencies; also use shapes, line styles, or direct labels
20```python
21sns.set_palette("colorblind")
22sns.color_palette("Set2")
23```

Qualitative Palettes (Categorical Data)

Distinguish categories through hue variation:

  • "deep" - Default, vivid colors
  • "muted" - Softer, less saturated
  • "pastel" - Light, desaturated
  • "bright" - Highly saturated
  • "dark" - Dark values
  • "colorblind" - Designed to improve distinction for common color vision deficiencies; also use shapes, line styles, or direct labels
sns.set_palette("colorblind")
sns.color_palette("Set2")
Raw lines 10 to 24
25### Sequential Palettes (Ordered Data)
27Show progression from low to high values:
28- `"rocket"`, `"mako"` - Wide luminance range (good for heatmaps)
29- `"flare"`, `"crest"` - Restricted luminance (good for points/lines)
30- `"viridis"`, `"magma"`, `"plasma"` - Matplotlib perceptually uniform
32```python
33sns.heatmap(data, cmap='rocket')
34sns.kdeplot(data=df, x='x', y='y', cmap='mako', fill=True)
35```

Sequential Palettes (Ordered Data)

Show progression from low to high values:

  • "rocket", "mako" - Wide luminance range (good for heatmaps)
  • "flare", "crest" - Restricted luminance (good for points/lines)
  • "viridis", "magma", "plasma" - Matplotlib perceptually uniform
sns.heatmap(data, cmap='rocket')
sns.kdeplot(data=df, x='x', y='y', cmap='mako', fill=True)
Raw lines 25 to 36
37### Diverging Palettes (Centered Data)
39Emphasize deviations from a midpoint:
40- `"vlag"` - Blue to red
41- `"icefire"` - Blue to orange
42- `"coolwarm"` - Cool to warm
43- `"Spectral"` - Rainbow diverging
45```python
46sns.heatmap(correlation_matrix, cmap='vlag', center=0)
47```

Diverging Palettes (Centered Data)

Emphasize deviations from a midpoint:

  • "vlag" - Blue to red
  • "icefire" - Blue to orange
  • "coolwarm" - Cool to warm
  • "Spectral" - Rainbow diverging
sns.heatmap(correlation_matrix, cmap='vlag', center=0)
Raw lines 37 to 48
49### Custom Palettes
51```python
52# Create custom palette
53custom = sns.color_palette("husl", 8)
55# Light to dark gradient
56palette = sns.light_palette("seagreen", as_cmap=True)
58# Diverging palette from hues
59palette = sns.diverging_palette(250, 10, as_cmap=True)
60```

Custom Palettes

# Create custom palette
custom = sns.color_palette("husl", 8)

# Light to dark gradient
palette = sns.light_palette("seagreen", as_cmap=True)

# Diverging palette from hues
palette = sns.diverging_palette(250, 10, as_cmap=True)
Raw lines 49 to 61
62## Theming and Aesthetics

Theming and Aesthetics

Raw lines 62 to 63
64### Set Theme
66`set_theme()` controls overall appearance:
68```python
69# Set complete theme
70sns.set_theme(style='whitegrid', palette='pastel', font='sans-serif')
72# Reset to defaults
73sns.set_theme()
74```

Set Theme

set_theme() controls overall appearance:

# Set complete theme
sns.set_theme(style='whitegrid', palette='pastel', font='sans-serif')

# Reset to defaults
sns.set_theme()
Raw lines 64 to 75
76### Styles
78Control background and grid appearance:
79- `"darkgrid"` - Gray background with white grid (default)
80- `"whitegrid"` - White background with gray grid
81- `"dark"` - Gray background, no grid
82- `"white"` - White background, no grid
83- `"ticks"` - White background with axis ticks
85```python
86sns.set_style("whitegrid")
88# Remove spines
89sns.despine(left=False, bottom=False, offset=10, trim=True)
91# Temporary style
92with sns.axes_style("white"):
93 sns.scatterplot(data=df, x='x', y='y')
94```

Styles

Control background and grid appearance:

  • "darkgrid" - Gray background with white grid (default)
  • "whitegrid" - White background with gray grid
  • "dark" - Gray background, no grid
  • "white" - White background, no grid
  • "ticks" - White background with axis ticks
sns.set_style("whitegrid")

# Remove spines
sns.despine(left=False, bottom=False, offset=10, trim=True)

# Temporary style
with sns.axes_style("white"):
    sns.scatterplot(data=df, x='x', y='y')
Raw lines 76 to 95
96### Contexts
98Scale elements for different use cases:
99- `"paper"` - Smallest
100- `"notebook"` - Default context, slightly larger
101- `"talk"` - Presentation slides
102- `"poster"` - Large format
104```python
105sns.set_context("talk", font_scale=1.2)
107# Temporary context
108with sns.plotting_context("poster"):
109 sns.barplot(data=df, x='category', y='value')
110```
112Reviewed against [the palette tutorial](https://seaborn.pydata.org/tutorial/color_palettes.html) and [plotting_context](https://seaborn.pydata.org/generated/seaborn.plotting_context.html), 2026-10-01. A palette name alone does not establish accessibility for a finished figure.

Contexts

Scale elements for different use cases:

  • "paper" - Smallest
  • "notebook" - Default context, slightly larger
  • "talk" - Presentation slides
  • "poster" - Large format
sns.set_context("talk", font_scale=1.2)

# Temporary context
with sns.plotting_context("poster"):
    sns.barplot(data=df, x='category', y='value')

Reviewed against the palette tutorial and plotting_context, 2026-10-01. A palette name alone does not establish accessibility for a finished figure.

Raw lines 96 to 112