I have worked with the mouse events where, if I click on the particular point on the scatter plot, I get the coordinates of that particular point. Is the same possible to grab the points on that particular curve if I click on that curve using matplotlib events?
This is the code I use to get the mouse coordinates:
import matplotlib.pyplot as plt
def onclick(event):
print(event.xdata, event.ydata)
fig,ax = plt.subplots()
ax.plot(range(10))
fig.canvas.mpl_connect('button_press_event', onclick)
plt.show()