带有 seaborn 的多个箱线图,但不在同一帧内

Multiple boxplot with seaborn, but not within the same frame

如果是 pandas 箱线图,我们可以使用:

for column in df:
    plt.figure()
    df.boxplot([column])

使用 seaborn 可以等效地完成什么,我想绘制多个箱线图,但不是在同一帧中,而是在循环

中单独绘制每一列

您可以将 Axes 对象传递给 sns.boxplot:

for column in df:
    fig, ax = plt.subplots()
    sns.boxplot(df[column], ax=ax)