【发布时间】:2020-09-20 19:08:03
【问题描述】:
如果是熊猫箱线图,我们可以使用:
for column in df:
plt.figure()
df.boxplot([column])
使用seaborn 可以等效地完成什么,我想绘制多个箱线图,但不是在同一帧中,而是在循环中单独为每一列绘制
【问题讨论】:
标签: python dataframe matplotlib seaborn boxplot
如果是熊猫箱线图,我们可以使用:
for column in df:
plt.figure()
df.boxplot([column])
使用seaborn 可以等效地完成什么,我想绘制多个箱线图,但不是在同一帧中,而是在循环中单独为每一列绘制
【问题讨论】:
标签: python dataframe matplotlib seaborn boxplot
您可以将Axes 对象传递给 sns.boxplot:
for column in df:
fig, ax = plt.subplots()
sns.boxplot(df[column], ax=ax)
【讨论】:
y=df[column] 而不是x=df[column],它只是df[column] 的缩写