I started with python yesterday and so far I have made a graph in which uses 4 columns of data from a .txt file. Everything is working great. Now what I would like to have is a dragable bar or something like that. That you can drag through the graph and get the values from y, y1 and y2 at any given time (which is the X-value) presented in a textbox or something in that matter. Problem is, I don't even now what to search for to begin exploring alternatives.
Using matplotlib and numpy.
Code here.
import numpy as np
import matplotlib.pyplot as plt
data = np.loadtxt('test.txt')
x = data[:, 0]
y = data[:, 1]
y2 = data[:, 2]
y3 = data[:, 3]
fig = plt.figure(figsize=(18,5))
ax = fig.add_subplot(111)
ax.plot(x, y, '--', label='Voltage')
ax.plot(x, y2, '-.', label='Current')
ax2 = ax.twinx()
ax2.plot(x, y3,'g:', label='Temperature')
fig.legend(edgecolor = ("DarkBlue"), facecolor = ("LightBlue"), loc="upper right", bbox_to_anchor=(1,1), bbox_transform=ax.transAxes)
ax.set_title("Test Surveillance", color = ("Purple"))
ax.set_xlabel('Milliseconds', color = ("LightGreen"))
ax.set_ylabel('Volts and Amps', color = ("DarkGrey"))
ax2.set_ylabel('Celsius', color = ("LightBlue"))
ax2.set_ylim(18, 100)
plt.xlim(0)
plt.show()