easiest way to plot x,y graphically during run-time?
Brian Blais
bblais at bryant.edu
Wed Jun 3 13:32:13 EDT 2009
On Jun 3, 2009, at 12:15 , Esmail wrote:
> Gökhan SEVER wrote:
>> It seems like you want to animate your data.
>> You may want to take a look at Matplotlib examples or Mayavi for 3D
>
> I've used Matplotlib to plot points that were saved during runtime to
> a file. I wonder if I could skip that step and directly plot during
> runtime updating the graph as values changed ..
here is a sample. again, direct questions to the matplotlib list for
possible better ideas.
from pylab import *
# initial positions
x0=rand(5)
y0=rand(5)
ion() # interactive on
for t in linspace(0,10,100):
x=x0+0.1*cos(t)
y=y0+0.1*sin(t)
if t==0: # first time calling
h=plot(x,y,'o')
else:
h[0].set_data(x,y)
draw()
bb
--
Brian Blais
bblais at bryant.edu
http://web.bryant.edu/~bblais
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20090603/83431eb8/attachment-0001.html>
More information about the Python-list
mailing list