我想輸入 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()
1 回答

米脂
TA貢獻1836條經驗 獲得超3個贊
該factorplot函數已catplot在 Seaborn 中重命名為。但我認為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()
添加回答
舉報
0/150
提交
取消