Hi, You are right. I have tried set_array before, but forgot to mention it. I have retried now and got it working. Like you said one has to ravel() the array and use this with QuadMeshs set_array function.
Thanks. Manuel 2011/12/4 Tony Yu <tsy...@gmail.com>: > > > On Sun, Dec 4, 2011 at 9:59 AM, Manuel Jung <mj...@astrophysik.uni-kiel.de> > wrote: >> >> Hi, >> >> I have plt.pcolormesh plot i would like to animate. So i've taken a >> look at the various examples and decided to go with the FuncAnimation >> routine. This works for me, but im using for every frame a new call to >> plt.colormesh and i am not updating the underlaying data, like in this >> example >> http://matplotlib.sourceforge.net/examples/animation/dynamic_image.html >> This is because there seems to be no set_data, set_array or similar >> for the from plt.colormesh returned object (an instance of >> matplotlib.collection.QuadMesh). Am i right? Is there any way i can >> update the data structures of plt.colormesh? >> > Hi Manuel, > > You can call QuadMesh's `set_array` method, just as you can for images. (You > suggest there is no set_array method for QuadMesh; are you sure about that?) > The strange part is that it expects a 1d array, where as colormesh accepts > arrays of various dimensions. > >>>> import numpy as np >>>> import matplotlib.pyplot as plt >>>> mesh = plt.pcolormesh(np.random.rand(10,10)) >>>> mesh.set_array(np.random.rand(10,10).ravel()) >>>> plt.draw() > > set_array doesn't complain if you remove the call to `ravel`, but > `plt.draw()` will complain. > > -Tony ------------------------------------------------------------------------------ All the data continuously generated in your IT infrastructure contains a definitive record of customers, application performance, security threats, fraudulent activity, and more. Splunk takes this data and makes sense of it. IT sense. And common sense. http://p.sf.net/sfu/splunk-novd2d _______________________________________________ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users