開始使用免費開始

移除脊線(spines)

一般來說,視覺化應該盡量減少多餘的標記,讓資料自己說話。Seaborn 允許你移除上、下、左、右各邊的座標軸線,這些線通常稱為脊線(spines)。

本練習屬於課程

Seaborn 資料視覺化中級

檢視課程

練習說明

  • 將圖形樣式設為 white
  • 使用 lmplot() 比較 pop2010fmr_2 欄位。
  • 使用 despine() 移除上方與右側的脊線。

動手互動練習

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

# Set the style to white
sns.set_style('____')

# Create a regression plot
sns.lmplot(data=df,
           x='pop2010',
           y='fmr_2')

# Remove the spines
sns.____()

# Show the plot and clear the figure
plt.show()
plt.clf()
編輯並執行程式碼