首页 > 解决方案 > 更改 seaborn pair plot 图形大小

问题描述

我有以下代码

sns.pairplot(data=train, 
              x_vars=['x'],
              y_vars=['y'])
plt.show()

如果这有什么不同,我正在 jupyter notebook 中编程,我想绘制一个更大的图,但我做不到。我搜索互联网和文档提到使用高度属性 https://seaborn.pydata.org/generated/seaborn.pairplot.html 但是在使用以下代码时总是会导致错误。

sns.pairplot(data=train, height=3,
              x_vars=['x'],
              y_vars=['y'])
plt.show()

TypeError: pairplot() got an unexpected keyword argument 'height'

标签: python-3.xjupyter-notebookseaborn

解决方案


height参数在 seaborn 0.9.0 中可用。

sns.pairplot(..., height=3)

在 seaborn 0.8.1(或更低版本)中,这个参数被命名为size.

sns.pairplot(..., size=3)

推荐阅读