Working 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:
- 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; - Plot level (
paletteargument): 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_rreverses any palette);magma.
Study More
You can find the full list of available palettes and color codes in the official Seaborn documentation.
すべて明確でしたか?
フィードバックありがとうございます!
セクション 1. 章 2
AIに質問する
AIに質問する
何でも質問するか、提案された質問の1つを試してチャットを始めてください
セクション 1. 章 2