如何将所有解释变量的多散点图拉取到python中的响应变量。生成的错误如下所示,无论我将 squeeze 设置为 True 还是 False。类型错误: 'AxesSubplot' 对象不可下标f, axes = plt.subplots(6, 4, figsize=(20, 20), sharex=False, squeeze=False)for i,col in enumerate(chef_num.columns[1:]): sns.scatterplot(x=chef_num[col], y=chef_num['REVENUE'], ax=ax[i])
1 回答

拉丁的传说
TA贡献1789条经验 获得超8个赞
您的轴数组称为 ,而不是您应该调用axes
ax.
sns.scatterplot(..., ax=axes[i,j])
请注意,这是一个 2D 数组,因此您需要两个计数器,或者迭代一个扁平的轴数组:axes
for ax,col in zip(axes.flat, chef_num.columns[1:]): sns.scatterplot(x=chef_num[col], y=chef_num['REVENUE'], ax=ax)
添加回答
举报
0/150
提交
取消