[Matplotlib-users] mouse cursor coordinates
fiolj at yahoo.com
Mon May 30 08:36:47 EDT 2016
It works well in my system (linux gentoo) with ipython-4.0.3,
python-2.7.10 and python-3.4.3.
Did you try running it outside spyder?
May be save it into a file (test_cursor.py) and run it directly from a
system console to see if the problem is with spyder.
Anyway, I am not very experienced. May be someone else may have a better
On 30/05/16 07:17, grivet wrote:
> I want to retrieve the mouse cursor coordinates when i click inside a
> figure. I have tried a variety ef example programs, such as
> from pylab import *
> fig = plt.figure()
> ax = fig.add_subplot(111)
> def onclick(event):
> print("button=%d, x=%d, y=%d, xdata=%f, ydata=%f" %(
> event.button, event.x, event.y, event.xdata, event.ydata))
> cid = fig.canvas.mpl_connect('button_press_event', onclick)
> ax.set_title("click on figure")
> The figure gets plotted, then nothing happens: the program simply ends
> and focus retruns to the IPython console.
> I am using distribution Anaconda/Python35/Spyder under Win7-64. What did
> I miss ?
> Thank you for your help,
> JP Grivet
> Matplotlib-users mailing list
> Matplotlib-users at python.org
More information about the Matplotlib-users