【发布时间】:2012-05-04 11:18:57
【问题描述】:
c = file('cluster_info.txt')
for i in zip(ys[-10:],result): # has ten elements
for j in c.readlines():
cluster = j.split(',')
if q in cluster:
m = (q[i],cluster[0])
f = pylab.figure() # code for plot starts here
for n, fname in enumerate(m):
image=Image.open(fname).convert("L")
arr=np.asarray(image)
f.add_subplot(2, 1, n) # this line outputs images on top of each other
pylab.imshow(arr,cmap=cm.Greys_r)
pylab.title("%s, Top:Predicted,Bottom:Observed" %i[0])
pylab.show()
else:
continue
这是来自较大代码的 sn-p,我希望生成 10 个图像/绘图,但 python 不生成绘图。我想我没有将 if 和 else: 正确嵌套在 for 循环中。请告诉我这里出了什么问题。
【问题讨论】:
-
do-my-work-for-me 标签在哪里?
标签: python if-statement for-loop