Antonino Ingargiola wrote: > On 4/1/07, Antonino Ingargiola <[EMAIL PROTECTED]> wrote: >> On 3/29/07, Ken McIvor <[EMAIL PROTECTED]> wrote: > [cut] >>>> The last think I'm not yet able to do is to update the colorbar to >>>> autoscale with the new incoming data. The the script that follows >>>> tries to update the colorbar too but it does not work (on matplotlib >>>> 0.87 at least). >>> I have no idea if this will help, but you might need to call >>> AxesImage.changed() after calling AxesImage.set_data(). >> That doesn't help :(. I'm not jet able to update the colorbar once the >> image has changed.
I have made a change in svn that should solve the problem. Now the following sequence works as expected (illustrated with ipython -pylab): In [1]:IM = imshow(rand(3,4)) In [2]:CB = colorbar() In [3]:IM.set_data(10*rand(3,4)) In [4]:draw() In [5]:IM.autoscale() In [6]:draw() In [7]:IM.set_clim((0,20)) In [8]:draw() The colorbar tracks the image, and either IM.autoscale or IM.set_clim causes the color mapping range to change for both the colorbar and the image. Eric > > I've found a way to update the colorbar after the image has changed: > > image = imshow(data) > colr_bar = colorbar() > > ... > > image.set_data(new_data) > image.changed() > color_bar.set_clim(vmax=newdata.max()) > draw() > > The autoscale() colorbar method does not work to update a colorbar, > but with the above code I can acheive the same result. > > Thanks again. > > ~ Antonio ------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys-and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV _______________________________________________ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users