Hello,

I read a simple data stream from my computers serial port. I can nicely read
the data using pyserial library but couldn't get it *nicely* working neither
with WXAgg nor Qt4Agg using the following code. Although with WX I could get
updated looks, the figure isn't very responsive in this way. I have looked
at simple_idle_wx example but for some reason I can't make it work to update
the canvas whenever the condition satisfied.

What is the trick to make the real-time data plotted on the screen easily
without blocking the figure itself?

import serial
import matplotlib.pyplot as plt
plt.ion()

ser = serial.Serial(0)

conc = []
while True:
    s = ser.readline()
    if s.startswith('CONC'):
        conc.append(float(s.split()[2]))
        plt.plot(conc)
        plt.show()
        plt.clf()

ser.close()

-- 
Gökhan
------------------------------------------------------------------------------
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to