Ray,
The first problem is that you are calling show() repeatedly, but show()
should only be called once per script; it is used in non-interactive
plotting. Now I see that you are trying to prevent that, but the code
as it came out in your email does not do so--val never gets set to zero.
Note that by default, repeated calls to plot overlay more and more plot
elements; I don't think this is what you want.
To get ideas, you might look at anim.py and strip_chart_demo.py in the
examples directory.
Eric
ray sa wrote:
> Hello
>
> I am trying to use this application to plot a diagram from a log file
> that is always active and storing data. I have written the following and
> I have issues once I touch the figure window it freezes...
>
> from pylab import *
> import time
> val = 1
>
> while True:
> inData = load('c:\\data.txt')
> x = inData[:,0]
> y = inData[:,1]
> plot(x,y,'o')
> if val == 1:
> show()
> time.sleep(1)
> if val == 0:
> val = 0
> time.sleep(1)
> draw()
>
> I am using the following program to create some dummy data:
>
> import time
> import math
>
> def test():
> for i in range(900):
> for rad in sineVal:
> fileData = open('c:\\data.txt','a')
> time.sleep(1)
> fileData.write('%d' % int(i))
> fileData.write('\t')
> fileData.write('%f' % math.sin(rad))
> fileData.write('\n')
> fileData.close()
> print('*'),
>
> def makeArray():
> tempArray = []
> for i in range(0,360,180):
> tempArray.append(i)
> return tempArray
>
> sineVal = makeArray()
>
> test()
>
> You help and suggestion in the above matter will be most welcomed.
>
-------------------------------------------------------------------------
SF.Net email is sponsored by: The Future of Linux Business White Paper
from Novell. From the desktop to the data center, Linux is going
mainstream. Let it simplify your IT future.
http://altfarm.mediaplex.com/ad/ck/8857-50307-18918-4
_______________________________________________
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users