I've been trying to get a graph in real time with matplotlib but it's almost impossible, is there any way I can do this?
The issue is that I am receiving data through the usb port and I am storing them in a list, which is increasing as there is new data. What I want is that as a new data is received (which is very very fast) it will be shown in a graph in real time.
I tried like this but it did not work:
import matplotlib.pyplot as plt
import analog
b = analog('COM3')
g = []
while (True):
val = b.analogRead(pin)
res = int((int(val) * 250000) / 1023)
g.append(res)
print("%s ............... %s" % (res, t))
plt.figure(1)
plt.plot(g)
plt.show(block = False)
plt.close('all')