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")

带色相的葡萄酒质量图

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

按列分面的葡萄酒质量图

Seaborn 数据可视化进阶

Passons à la pratique !

Seaborn 数据可视化进阶

Preparing Video For Download...