【发布时间】:2017-04-11 07:03:45
【问题描述】:
我想要什么:
我想使用一个函数绘制大约 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))
【问题讨论】:
-
@Eliethesaiyan 不,我没有面对具有不同因素的同一个变量。我想做的是用函数可视化数据集的 8 个不同列,所有图都应该不同。
-
你提供的代码有什么用?
-
code-1 给了我 8 个图(全部完全相同,仅在一列上),code-2 产生 1 个图,所有列密度一起可视化。
-
我明白了....我认为您正在寻找的是我不熟悉的子图,但这个答案可能会有所帮助stackoverflow.com/questions/33925494/…
标签: python matplotlib plot visualization seaborn