0

Problem solve at that post in matplotlib documentation: https://matplotlib.org/stable/users/event_handling.html

Alejandro
  • 1
  • 3

1 Answers1

0

For your first question, you may have a look at this

Matplotlib Plot Points Over Time Where Old Points Fade

For the second one, try something like this

#list to store the points
points = []

#click event
def onclick(event):
    global points
    print('button=%d, x=%d, y=%d, xdata=%f, ydata=%f' %
          (event.button, event.x, event.y, event.xdata, event.ydata))
    #store the points in a list
    points.append([event.x, event.y, event.xdata, event.ydata])
    plt.plot(event.xdata, event.ydata, ',')

With every click, the set of points is added to the points list. Vice versa, if you want to access e.g. the coordinates, stored with the third click, simply type

print(f"x={points[2][0]}, y={points[2][1]}, xData={points[2][2]}, yData={points[2][3]}")
stranger0612
  • 301
  • 1
  • 2
  • 12