Matplotlib 色碼
Seaborn 提供多種方式來調整視覺化的顏色。
最直接的方法是明確指定圖表的顏色。想快速換色,你可以使用標準的 matplotlib 色碼。
本練習屬於課程
Seaborn 資料視覺化中級
練習說明
- 設定 Seaborn 的預設樣式,並啟用
matplotlib的色碼。 - 使用
matplotlib的紫紅色(m)色碼,為fmr_3欄位建立一個displot。
動手互動練習
試著完成這個範例程式碼,體驗一下這個練習。
# Set style, enable color code, and create a magenta displot
sns.set(color_codes=____)
sns.displot(df['fmr_3'], color='____')
# Show the plot
plt.____()