【发布时间】:2017-04-19 16:34:38
【问题描述】:
在here 和here 上阅读时,它们使用format_coord 从工具栏中禁用坐标或更改格式。
在链接的问题中使用axe.format_coord = lambda x, y: '',删除坐标,这很好。但是,我也想禁用像素值:
然后我尝试使用
axe.format_coord = lambda x, y,z:''
但这给出了一个错误:
s = event.inaxes.format_coord(event.xdata, event.ydata)
TypeError: <lambda>() takes exactly 3 arguments (2 given)
请帮我解决它。
【问题讨论】:
-
之前
axe.format_coord的值是多少? -
从错误中可以看出,你不能使用
z作为附加参数,因为lambda函数总是用2个参数(x,y)调用。 -
以前的值是
axe.format_coord = lambda x, y: ''非常完美,因为我还想从工具栏禁用坐标
标签: python matplotlib axes