Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/312.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python Matplotlib-从列表中的项生成的点标签_Python_Plot_Matplotlib_Label - Fatal编程技术网

Python Matplotlib-从列表中的项生成的点标签

Python Matplotlib-从列表中的项生成的点标签,python,plot,matplotlib,label,Python,Plot,Matplotlib,Label,使用matplotlib,我定义了以下打印标签的函数。标签位于正确的位置,但标签不正确 def printPointLabel(x,y,z,iternum,ax): print x label = '(%d, %d), ITER%s' % (x, y, iternum) ax.text(x, y, z, label) 我为for循环中的四个不同点调用printPointLabel for i,num,c in zip((0,sampl4,2*sampl4,len(si

使用matplotlib,我定义了以下打印标签的函数。标签位于正确的位置,但标签不正确

def printPointLabel(x,y,z,iternum,ax):
    print x 
    label = '(%d, %d), ITER%s' % (x, y, iternum)
    ax.text(x, y, z, label)
我为for循环中的四个不同点调用printPointLabel

for i,num,c in zip((0,sampl4,2*sampl4,len(simplexpath)-1),(0,sampl4,2*sampl4,len(simplexpath)),('r','r','g','b')):
    appendSimplex(xs,ys,zs,col,simplexpath[i], peaks, c)
    printPointLabel(simplexpath[i][0][0],simplexpath[i][0][1],peaks([simplexpath[i]  [0][0],simplexpath[i][0][1]]),num,ax)
标签内容不会在每个循环中更新。它与第一个标签保持相同

你能帮忙吗

谢谢

>>> sampl4 = "samp14"
>>> simplexpath = "simplexpath"
>>> zip((0,sampl4,2*sampl4,len(simplexpath)-1),(0,sampl4,2*sampl4,len(simplexpath)),('r','r','g','b'))
[(0, 0, 'r'),
 ('samp14', 'samp14', 'r'),
 ('samp14samp14', 'samp14samp14', 'g'),
 (10, 11, 'b')]
您是否打算将
num
设置为
0,samp14,2*samp14,len(simplepath)-1


您能给我们一个输出样本吗?

这台机器有问题

ax.text(x, y, z, label)
打电话。
text
函数的调用签名是:

text(x, y, s, fontdict=None, **kwargs)

实际上,最后一个是
len(simplexpath)
,但关键是:这个拉链很奇怪。