seaborn.mpl_palette(name, n_colors=6)

Return discrete colors from a matplotlib palette.

Note that this handles the qualitative colorbrewer palettes properly, although if you ask for more colors than a particular qualitative palette can provide you will get fewer than you are expecting. In contrast, asking for qualitative color brewer palettes using color_palette() will return the expected number of colors, but they will cycle.

If you are using the IPython notebook, you can also use the function choose_colorbrewer_palette() to interactively select palettes.


name : string

Name of the palette. This should be a named matplotlib colormap.

n_colors : int

Number of discrete colors in the palette.


palette or cmap : seaborn color palette or matplotlib colormap

List-like object of colors as RGB tuples, or colormap object that can map continuous values to colors, depending on the value of the as_cmap parameter.


Create a qualitative colorbrewer palette with 8 colors:

>>> import seaborn as sns; sns.set()
>>> sns.palplot(sns.mpl_palette("Set2", 8))

Create a sequential colorbrewer palette:

>>> sns.palplot(sns.mpl_palette("Blues"))

Create a diverging palette:

>>> sns.palplot(sns.mpl_palette("seismic", 8))

Create a “dark” sequential palette:

>>> sns.palplot(sns.mpl_palette("GnBu_d"))