繁体   English   中英

如何与seaborn一起制作几个地块?

[英]How to make several plots with seaborn?

我想要的是:
我想使用一个函数绘制8个密度(小提琴)图(均在单独的图中),但是当我运行时,我会得到具有全部8个特征的单个图或同一特征的8个不同图。
如何使用函数在不同的图上绘制不同的图?

我当前的代码:

#CODE-1

#feature: a list of 8 features that i want to visualise
#visualise_univariate_feature: a function that plots a seaborn violin plot
#this code produces 8 plots but all on the same feature from the list(the last element of the list)

for i in range(9):
plt.figure(i)
for feature in features:
    display(visualise_univariate_feature(x=feature))

#CODE-2 

#This code produces 1 plot with 8 features all together
for feature in features:
   display(visualise_univariate_feature(x=feature))

如果不了解visualise_univariate_feature就不可能给出明确的答案。

但是你可以尝试

for i, feature in enumerate(features):
    plt.figure(i+1)
    display(visualise_univariate_feature(x=feature))

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM