Hi,

I'm trying to get matplotlib to replot a pcolor image as data in a file 
is updated.  What's the proper way to do this?  The best approach I 
could come up with is as follows:

import threading, time
import numpy as N
import matplotlib.pyplot as P

def update_plot(*args):
     ax = args[0]
     while True:
         data = N.random.rand(10,10)
         if ax.collections:
             del ax.collections[0]
         ax.pcolor(data)
         print 'drawing'
         P.draw()
         time.sleep(1)

P.ion()
f = P.figure()
ax = f.add_subplot(1,1,1)
ax.set_xlabel('X Axis')
ax.set_ylabel('Y Axis')

t = threading.Thread(name='Plot', target=update_plot, args=(ax,))
t.start()
P.show()

Can anyone point me in the right direction?

Thanks,

Ryan

-- 
Ryan May
Graduate Research Assistant
School of Meteorology
University of Oklahoma

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to