我想要的:
我想用一个函数来绘制大约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))发布于 2017-04-11 08:22:08
如果不了解visualise_univariate_feature,就不可能给出一个明确的答案。
不过,你可以试试
for i, feature in enumerate(features):
plt.figure(i+1)
display(visualise_univariate_feature(x=feature))https://stackoverflow.com/questions/43338924
复制相似问题