I have a scatter plot in python with the option picker=True
Now I want to open another python Script with a parameter based on the point I picked.
I do have a working event
self.fig.canvas.mpl_connect('pick_event', self.onpick)
def onpick(self, event):
artist = event.artist
print("Hello")
...
# The scatter plot is created with
plt.scatter(data[:, 0], data[:, 1], cmap=cmap, c=data[:, 2], s=100, picker=True)
Always when I click on a scatter point python prints Hello.
Now I would love to add a simple information to each artist (e.g. the order they were created as an int), so when I click it, I can access this information and use it as my parameter for the python script I want to open on click.
An other (worse) idea would be, to get the Position of that artist in my plot and then calculate my parameter based on the Position of that artist.
Sadly, I couldn't find any information if one of the ideas is possible. I found at https://matplotlib.org/2.0.0/users/artists.html that artists have an x and an y Value, but I couldn't access it.
Any suggestions?