Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Learn Working with Color Palettes | Section
Practice
Projects
Quizzes & Challenges
Quizzes
Challenges
/
Statistical Visualization with Seaborn

bookWorking with Color Palettes

It is essential to choose the right color for the plot. If your plot looks good, it will be easy to study it.

Setting the Palette

There are two main ways to set colors in Seaborn:

  1. Global level (set_palette): this changes the colors for all plots created afterwards. It is useful when you want a consistent style throughout your entire notebook;
  2. Plot level (palette argument): this changes colors only for the specific plot.
# 1. Global setting (affects all future plots)
sns.set_palette('mako')

# 2. Local setting (affects only this plot)
sns.countplot(x=data, palette='mako')

Common Palettes

Instead of guessing colors, you can use these built-in Seaborn palette names:

  • Categorical (qualitative): best for distinct categories (e.g., fruits, cities).
  • deep (default);
  • muted;
  • bright;
  • pastel;
  • dark;
  • colorblind.
  • Sequential (perceptually uniform): best for showing numeric progression or intensity.
  • rocket (warm);
  • mako (cool, teal-blue);
  • flare;
  • crest;
  • virdis;
  • rocket_r (adding _r reverses any palette);
  • magma.
Note
Study More

You can find the full list of available palettes and color codes in the official Seaborn documentation.

question mark

You want to apply the 'magma' palette only to the current countplot, without changing the colors for any future plots. Which code should you use?

Select the correct answer

Everything was clear?

How can we improve it?

Thanks for your feedback!

SectionΒ 1. ChapterΒ 2

Ask AI

expand

Ask AI

ChatGPT

Ask anything or try one of the suggested questions to begin our chat

bookWorking with Color Palettes

Swipe to show menu

It is essential to choose the right color for the plot. If your plot looks good, it will be easy to study it.

Setting the Palette

There are two main ways to set colors in Seaborn:

  1. Global level (set_palette): this changes the colors for all plots created afterwards. It is useful when you want a consistent style throughout your entire notebook;
  2. Plot level (palette argument): this changes colors only for the specific plot.
# 1. Global setting (affects all future plots)
sns.set_palette('mako')

# 2. Local setting (affects only this plot)
sns.countplot(x=data, palette='mako')

Common Palettes

Instead of guessing colors, you can use these built-in Seaborn palette names:

  • Categorical (qualitative): best for distinct categories (e.g., fruits, cities).
  • deep (default);
  • muted;
  • bright;
  • pastel;
  • dark;
  • colorblind.
  • Sequential (perceptually uniform): best for showing numeric progression or intensity.
  • rocket (warm);
  • mako (cool, teal-blue);
  • flare;
  • crest;
  • virdis;
  • rocket_r (adding _r reverses any palette);
  • magma.
Note
Study More

You can find the full list of available palettes and color codes in the official Seaborn documentation.

question mark

You want to apply the 'magma' palette only to the current countplot, without changing the colors for any future plots. Which code should you use?

Select the correct answer

Everything was clear?

How can we improve it?

Thanks for your feedback!

SectionΒ 1. ChapterΒ 2
some-alt