我正在尝试使用并行循环创建一些内核图。当我使用条形图时循环工作,但当我使用内核图时会出错。我是 python 新手,所以我认为我遗漏了一些非常明显的东西 - 有什么建议吗?谢谢!
哦和len(schools) = 3
#the kernel plot
fig = plt.figure(facecolor='white')
gs1 = GridSpec(1,len(schools))
sp1 = [plt.subplot(gs1[0,i]) for i in range(len(schools))]
colors = ["red", "blue", "green"]
schools2 = [[data1....],[data2....],[data3......]]
for ax, i in zip(sp1, range(len(schools))):
ax = sns.kdeplot(schools2[i], bw=.5, color = colors[i], lw=1.8, vertical=True, alpha=.5)
.
#the bar plot
fig = plt.figure(facecolor='white')
gs1 = GridSpec(1,len(schools))
sp1 = [plt.subplot(gs1[0,i]) for i in range(len(schools))]
colors = ["red", "blue", "green"]
test = [1,2,3]
for ax, i in zip(sp1, range(3)):
ax.bar(1, test[i], color = colors[i])