, Hi guys, I'm using python>matplotlib and I want to get the data from the plot by using the cursor.
import numpy as np
import matplotlib.pyplot as plt
t = np.arange(0., 2., 0.1)
plt.plot(t,t,'g^')
ax = plt.gca()
line = ax.lines[0]
xd = line.get_xdata()
yd = line.get_ydata()
valx = np.where(xd==xd[0])
plt.show()
In the plot there will be 19 dots from 0,0 to 1.9,1.9; so...
When I click on 0,0 first and then on 0.3,0.3, I want to get the values:
(0,0);
(0.1,0.1);
(0.2,0.2);
(0.3,0.3)
Is there a way to do this?
But also there's a problem that the cursor has to be over the point, is there a way to position the cursor on the graphic and not other point???