【发布时间】:2020-12-02 21:06:38
【问题描述】:
我不明白下面的 n +=1 变量如何将 distplot 可视化分成 3 列
n=0
for x in ['Age', 'Annual Income (k$)', 'Spending Score (1-100)']:
n +=1
plt.subplot(1,3,n)
plt.subplots_adjust(hspace=0.5,wspace = 0.5)
sns.distplot(df[x], bins = 20)
plt.title('Displot of {}'.format(x))
plt.show()
请看附件distplotenter image description here的照片
【问题讨论】:
-
附带说明,您可以改为枚举 -
for n, x in enumerate(['Age', 'Annual Income (k$)', 'Spending Score (1-100)']): -
这能回答你的问题吗? What does += mean in Python?
标签: python matplotlib seaborn