我想输入2个表格以适合1行和2列
所以我设置了子图(1,2)但用空图显示(2,2)形状
(我将Jupyter笔记本与%matplotlib inline
一起使用)
我该如何解决?
f,ax=plt.subplots(1,2,figsize=(20,8))
sns.barplot('SibSp','Survived',data=train, ax=ax[0])
ax[0].set_title('SibSp vs Survived')
sns.factorplot('SibSp','Survived',data=train, ax=ax[1])
ax[1].set_title('SibSp vs Survived')
plt.show()
答案 0 :(得分:0)
在Seaborn中,factorplot
函数已重命名为catplot
。
但是我认为catplot
不接受轴参数(虽然不确定)。
最简单的方法是使用pointplot
而不是factorplot
。
f,ax=plt.subplots(1,2,figsize=(20,8))
sns.barplot('SibSp','Survived',data=train, ax=ax[0])
ax[0].set_title('SibSp vs Survived')
sns.pointplot('SibSp','Survived',data=train, ax=ax[1])
ax[1].set_title('SibSp vs Survived')
plt.show()