移除脊线(spines)
通常情况下,可视化应尽量减少多余的标记,让数据自己"发声"。Seaborn 允许您移除上下左右坐标轴上的线条,通常称为脊线(spines)。
本练习是课程的一部分
Seaborn 数据可视化进阶
练习说明
- 为图表使用
white样式。 - 使用
lmplot()比较pop2010和fmr_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()