easiest way to plot x,y graphically during run-time?

esmail bonakdarian ebonak at hotmail.com
Wed Jun 3 15:32:24 EDT 2009


Hi Brian,

Thanks for the code sample, that looks quite promising. I can
run it and understand most of it - my knowledge of pylab/matplotlib is
still quite rudimentary. I wish there was a good manual/tutorial that
could be printed off (or for that matter a book) on this as it seems
quite cabable and feature rich.

Esmail
---

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



_________________________________________________________________
Windows Live™ SkyDrive™: Get 25 GB of free online storage.
http://windowslive.com/online/skydrive?ocid=TXT_TAGLM_WL_SD_25GB_062009


More information about the Python-list mailing list