開始使用免費開始

視覺化 snake plot

做得好!現在你要使用轉換後的資料集來建立 snake plot。轉換後的資料已載入為 datamart_melt

seaborn 函式庫已以 sns 載入,matplotlib.pyplot 可用名稱為 plt

你可以使用主控台來探索這個轉換後的資料集。

本練習屬於課程

Python 的客群分群

檢視課程

練習說明

  • 加上圖表標題。
  • 將 X 軸標籤設為「Metric」。
  • 將 Y 軸標籤設為「Value」。
  • datamart_melt 中,針對 Cluster 的每個值繪製一條折線。

動手互動練習

試著完成這個範例程式碼,體驗一下這個練習。

# Add the plot title
plt.____('Snake plot of normalized variables')

# Add the x axis label
plt.____('____')

# Add the y axis label
plt.____('____')

# Plot a line for each value of the cluster variable
sns.____(____=____, x='____', y='____', hue='____')
plt.show()
編輯並執行程式碼