Written and maintained by CASRAI Editorial Board
Last updated
A seaborn color palette is a list of colors, or a continuous colormap, that seaborn applies to the groups or values in a figure. The seaborn documentation sorts palettes into three classes, qualitative, sequential and diverging, and the class you pick should follow the type of data you plot. This guide gives a decision table for that choice, the exact commands from the current seaborn documentation, the traps that make colors repeat or disappear, and a way to record the palette so a figure can be regenerated from your methods section.
Which palette for which data
Choose the palette class from the data, then choose a named palette inside that class. The names below are the ones the seaborn color palette tutorial uses.
| Your data | Palette class | Named palettes in the seaborn docs |
|---|---|---|
| Unordered groups (treatment arms, sites, species) | Qualitative: variation mainly in hue | deep (default), muted, pastel, bright, dark, colorblind; Color Brewer Set2 and Paired |
| Ordered or numeric values (concentration, dose, count) | Sequential: luminance is the main variation | rocket and mako (wide luminance range, suited to heatmaps); flare and crest (narrower luminance range, more hue variation, suited to lines and points); matplotlib magma and viridis |
| Numeric values with a meaningful midpoint (change from baseline, correlation) | Diverging: two dominant hues at the poles | vlag and icefire (blue and red poles); matplotlib coolwarm; Color Brewer Spectral |
The seaborn tutorial states the default is “a qualitative palette with ten distinct hues” that follows the ordering of matplotlib’s tab10 but is less intense. Calling sns.color_palette() with no arguments returns whatever palette is currently the default.
What it is used for in research
In a research figure the palette carries meaning: it tells the reader which points belong to the same group or how large a value is. Seaborn builds on matplotlib, so the same palettes work for scatter plots, box plots, histograms and heatmaps. Related CASRAI guides cover the plot types themselves, including scatter plots in Python and the histogram, and the figure-level rules in designing effective scientific figures and scientific figure rules for journal submission.
Install or access
The seaborn installation page lists these commands:
pip install seaborn
pip install seaborn[stats]
conda install seaborn
conda install seaborn -c conda-forge
The installation page notes that the conda-forge channel may carry newer releases. Seaborn requires numpy, pandas and matplotlib, and the page lists “Python 3.8+” under supported Python versions (check the page for the current wording).
Step by step: choose, set and apply a palette
- Look at the current default. Run
sns.color_palette(). With no arguments it returns the current default palette as a list of RGB tuples. - Request a named palette. Pass a name and, optionally, a number of colors:
sns.color_palette("tab10"),sns.color_palette("Set2"),sns.color_palette("Paired"),sns.color_palette("hls", 8)orsns.color_palette("husl", 8). The full signature isseaborn.color_palette(palette=None, n_colors=None, desat=None, as_cmap=False). - Request a continuous colormap for numeric data. Add
as_cmap=True:sns.color_palette("rocket", as_cmap=True). Append_rto reverse any continuous colormap, for example"rocket_r". - Build a palette from one color. The string forms
"light:b"and"dark:salmon_r"make a sequential palette from a single color;sns.light_palette("seagreen", as_cmap=True)andsns.dark_palette("#69d", reverse=True, as_cmap=True)do the same through functions."ch:start=.2,rot=-.3"orsns.cubehelix_palette(start=.5, rot=-.5, as_cmap=True)builds a cubehelix palette. - Build a diverging palette.
sns.diverging_palette(220, 20, as_cmap=True)gives a blue-to-red scale;sns.diverging_palette(250, 30, l=65, center="dark", as_cmap=True)sets a dark center. - Make it the default for every later plot.
sns.set_palette()changes the default. Its signature isseaborn.set_palette(palette, n_colors=None, desat=None, color_codes=False); it sets the matplotlib color cycle using a seaborn palette and accepts the same arguments ascolor_palette(). Withcolor_codes=Truethe matplotlib shorthand “b”, “g” and “r” is remapped to colors in the palette.
For a single plot, pass the palette to the plotting function’s palette argument alongside a hue variable;.
Output and how to read it
Without as_cmap=True, color_palette() returns a list of RGB tuples, one per color. With as_cmap=True it returns a matplotlib ListedColormap, which is what you hand to a heatmap or any plot that maps numbers to color.
Read the palette by class. In a qualitative palette, colors differ in hue and carry no order, so no group should look “higher” than another. In a sequential palette, darker or lighter means more or less, so the direction matters; reverse it with _r if the lighter end should mean larger. In a diverging palette, the middle color stands for the midpoint, so center it on a value that means something in your data.
Troubleshooting
Two groups share a color
Named palettes default to 6 colors, and asking for more colors than the palette holds cycles back to the start. If you have 8 groups, request them explicitly: sns.color_palette("hls", 8) or sns.color_palette("husl", 8), the forms the documentation shows with 8 colors.
The palette did not change the existing plots
color_palette() returns colors; it does not change the default. Use set_palette() to change the default for later plots, or pass the result to the palette argument of the plot you are drawing.
The extreme colors are missing from a discrete palette
The documentation notes that discrete versions of sequential colormaps omit the most extreme values. Use as_cmap=True when you want the full continuous range for numeric data.
n_colors seems to be ignored
The function reference states that n_colors is ignored when as_cmap=True, because a continuous colormap has no fixed number of colors.
Report the palette so the figure can be regenerated
A figure is easier to reproduce when the code names the palette and the number of colors instead of relying on the default. Write sns.set_palette("colorblind", n_colors=6) or sns.color_palette("rocket", as_cmap=True) in the script, and keep the string for custom palettes ("light:seagreen", "blend:#7AB,#EDA", "ch:start=.2,rot=-.3"), because the documented string forms light:, dark:, blend: and ch: let a reader rebuild the palette exactly. In the methods section or figure legend, state the seaborn palette name and, if you set it, the number of colors. Journal-specific requirements for figures are covered in the guide on scientific figure rules for journal submission.
Free alternatives
| Option | What it offers | Where it appears in the seaborn docs or on CASRAI |
|---|---|---|
| matplotlib colormaps | magma, viridis and coolwarm, usable directly in seaborn by name | Named in the seaborn color palette tutorial; any matplotlib colormap name is a valid palette string |
| Color Brewer palettes | Set2, Paired, Blues, YlOrBr, Spectral | Named in the seaborn color palette tutorial |
| ggplot2 colors (R) | The R route to the same task | See the CASRAI guide ggplot color |
FAQ
What are seaborn color palettes?
Seaborn color palettes are the lists and continuous colormaps that color_palette() returns and that seaborn plots use to color groups or values. The tutorial groups them as qualitative, sequential and diverging.
What is the default seaborn color palette?
The default is a qualitative palette with ten distinct hues that follows the ordering of matplotlib’s tab10 but is less intense. The variants deep, muted, pastel, bright, dark and colorblind adjust it.
How do I change seaborn colors for every plot?
Call sns.set_palette() once with a palette name or list. It sets the matplotlib color cycle from the seaborn palette and accepts the same arguments as color_palette().
How do I pick a seaborn color for one series?
Take a single entry from the list that color_palette() returns; each entry is an RGB tuple. To use a palette only temporarily, the function reference says color_palette() can also be used in a with statement to set the color cycle for a plot or set of plots.
Sources
- seaborn, Choosing color palettes: seaborn.pydata.org/tutorial/color_palettes.html (checked 2026-10-29)
- seaborn.color_palette reference: seaborn.pydata.org/generated/seaborn.color_palette.html (checked 2026-10-29)
- seaborn.set_palette reference: seaborn.pydata.org/generated/seaborn.set_palette.html (checked 2026-10-29)
- seaborn, Installing: seaborn.pydata.org/installing.html (checked 2026-10-29)








