Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Apprendre Colors | Light Start
Deep Dive into the seaborn Visualization

bookColors

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

Note

If you work with different categories - change colors.

If you work with different values - change colors for them.

Pay attention!

These 2 variants of setting the palette show different color results:

  • If you put the palette name with the .set_palette function, the colors will be changed for the plot elements;
  • If you put the palette as an argument in the plot function, colors will be used for the hue variable.
# 1st case
sns.set_palette('mako')
sns.countplot(...)
 
# 2nd case
sns.countplot(..., palette = 'mako')

To change the brightness and saturation, you can use these default styles:

To visualize the numeric values, we can use perceptually uniform palettes.

Some more palettes!

Here are presented some more matplotlib colors. You can use them if you're going to set one color for plot elements or customize the plot.

Tâche

Swipe to start coding

Try to set the palette!

Set the 'mako' palette for the countplot.

Solution

Tout était clair ?

Comment pouvons-nous l'améliorer ?

Merci pour vos commentaires !

Section 1. Chapitre 2
single

single

Demandez à l'IA

expand

Demandez à l'IA

ChatGPT

Posez n'importe quelle question ou essayez l'une des questions suggérées pour commencer notre discussion

Suggested prompts:

Résumer ce chapitre

Expliquer le code dans file

Expliquer pourquoi file ne résout pas la tâche

close

Awesome!

Completion rate improved to 4.35

bookColors

Glissez pour afficher le menu

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

Note

If you work with different categories - change colors.

If you work with different values - change colors for them.

Pay attention!

These 2 variants of setting the palette show different color results:

  • If you put the palette name with the .set_palette function, the colors will be changed for the plot elements;
  • If you put the palette as an argument in the plot function, colors will be used for the hue variable.
# 1st case
sns.set_palette('mako')
sns.countplot(...)
 
# 2nd case
sns.countplot(..., palette = 'mako')

To change the brightness and saturation, you can use these default styles:

To visualize the numeric values, we can use perceptually uniform palettes.

Some more palettes!

Here are presented some more matplotlib colors. You can use them if you're going to set one color for plot elements or customize the plot.

Tâche

Swipe to start coding

Try to set the palette!

Set the 'mako' palette for the countplot.

Solution

Switch to desktopPassez à un bureau pour une pratique réelleContinuez d'où vous êtes en utilisant l'une des options ci-dessous
Tout était clair ?

Comment pouvons-nous l'améliorer ?

Merci pour vos commentaires !

close

Awesome!

Completion rate improved to 4.35
Section 1. Chapitre 2
single

single

some-alt