開始使用免費開始

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.____()
編輯並執行程式碼