Seaborn 的迴歸圖

Seaborn 資料視覺化中級

Chris Moffitt

Instructor

regplot 入門

  • regplot 會繪製散佈圖並加上迴歸線
  • 用法與 displot 類似
  • 必須設定 dataxy 變數
sns.regplot(data=df, x="alcohol", y="pH" )

散佈圖

Seaborn 資料視覺化中級

lmplot() 建立在基礎的 regplot() 之上

  • regplot-低階
sns.regplot(data=df,
            x="alcohol",
            y="quality")

葡萄酒品質圖

  • lmplot-高階
sns.lmplot(data=df, 
           x="alcohol",
           y="quality")

葡萄酒品質圖

Seaborn 資料視覺化中級

lmplot 分面

  • 以顏色分組(hue
sns.lmplot(data=df, 
           x="quality",
           y="alcohol",
           hue="type")

含 hue 的葡萄酒品質圖

  • 以欄分面(col
sns.lmplot(data=df, 
           x="quality",
           y="alcohol",
           col="type")

以欄位分面的葡萄酒品質圖

Seaborn 資料視覺化中級

一起來練習吧!

Seaborn 資料視覺化中級

Preparing Video For Download...