使用 JointGrid 和 jointplot

Seaborn 数据可视化进阶

Chris Moffitt

Instructor

JointGrid() 概览

JointGrid 概览

Seaborn 数据可视化进阶

基础 JointGrid

g = sns.JointGrid(data=df, x="Tuition", y="ADM_RATE_ALL") 
g.plot(sns.regplot, sns.histplot)

JointGrid 示例

Seaborn 数据可视化进阶

高级 JointGrid

g = sns.JointGrid(data=df, x="Tuition", y="ADM_RATE_ALL") 
g = g.plot_joint(sns.kdeplot)
g = g.plot_marginals(sns.kdeplot, shade=True)

标注的 JointGrid 示例

Seaborn 数据可视化进阶

jointplot()

sns.jointplot(data=df, x="Tuition", y="ADM_RATE_ALL", kind='hex')

jointplot 示例

Seaborn 数据可视化进阶

自定义 jointplot

g = (sns.jointplot(x="Tuition",
                   y="ADM_RATE_ALL",
                   kind="scatter",
                   xlim=(0, 25000),
                   data=df.query('UG < 2500 &
                   Ownership == "Public"'))
    .plot_joint(sns.kdeplot))
Seaborn 数据可视化进阶

自定义 jointplot

jointplot

Seaborn 数据可视化进阶

让我们来练习!

Seaborn 数据可视化进阶

Preparing Video For Download...