[Matplotlib-users] mouse cursor coordinates

grivet grivet at cnrs-orleans.fr
Tue Jun 7 05:53:39 EDT 2016

I am still trying to plot some points inside a figure using the mouse, 
while storing the
points' coordinates for further use. I found the following example, 
which seems to
be a step in the right direction:

import matplotlib.pyplot as plt
plt.xlim(0, 10)
plt.ylim(0, 10)
mse = 0
while mse != []:
     mse = plt.ginput(timeout=10)
     if mse != []:
         plt.gca().add_artist(plt.Circle(mse[0], 0.1, alpha=0.9))

However, when I run this program (Spyder, Python 3.5, Win_7_64), I have 
to click twice
inside the figure to draw a single point.
Any suggestion ?

JP Grivet

More information about the Matplotlib-users mailing list