In Matplotlib, Python, I want to click and mark points (actually, a point calculated from its position, eventually), but it doesn't seem to be possible. Even something simple like this doesn't work:
from pylab import *
fig = plt.figure()
ax = fig.add_subplot(111)
ax.plot(np.random.rand(10))
def onclick(event):
print 'button=%d, x=%d, y=%d, xdata=%f, ydata=%f'%(
event.button, event.x, event.y, event.xdata, event.ydata)
plt.plot(event.xdata,event.ydata,',')
cid = fig.canvas.mpl_connect('button_press_event', onclick)
show()