more on continous plotting

Hello

Thanks for those whom have helped. I manage to get it to work but it is not working so smoothly. Does anyone know of another way I can achieve pleasant results? I am new to this with python and am trying to get my head around this. Basically I would like to plot a log file continuously whereby I can still use the span, zoom and rehome buttons without it opening many other windows.

Here is the code to generate the log data file:

import time
import math
import random

def test():
for i in range(900):
fileData = open(‘c:\data.txt’,‘a’)
time.sleep(1)
fileData.write(’%d’ % int(i))
fileData.write(’\t’)

fileData.write(’%f’ % int(random.random()5))
fileData.write(’\n’)
fileData.close()
print(’
’),

test()

Here is a code to plot with some edits and credit given to previous kind helpers.

from pylab import *
import time

tstart = time.time()

while True:
ion()
inData = load(‘c:\data.txt’)
x = inData[:,0]
y = inData[:,1]
plot(x,y,‘o’)
draw()
time.sleep(2)
print ‘FPS:’ , 200/(time.time()-tstart)

Looking forward to your help…BR /Ray

···

Get easy, one-click access to your favorites. Make Yahoo! your homepage.