ANN matplotlib-0.60.1

What's new in matplotlib-0.60.1

* figure images (pixel-by-pixel, not resampled) with the figimage
   command. Multiple figure images (ie mosaics) with alpha blending
   are supported. See
   http://matplotlib.sf.net/examples/figimage_demo.py

* multiple axes images with imshow using alpha blending. See
   http://matplotlib.sf.net/screenshots.html#layer_images

* unified color limit and color mapping arguments to pcolor, scatter,
   imshow and figimage. Interactive control of colormap and color
   scaling with new matplotlib.matlab commands jet, gray and clim.
   New matplotlib rc parameters for default image params. image
   origin can be upper or lower - see
   http://matplotlib.sf.net/examples/image_origin.py

* colorbar -
   http://matplotlib.sf.net/matplotlib.matlab.html#-colorbar - now
   works with imshow, pcolor, and scatter

* new 'draw' command to redraw the figure - use this in place of
   multiple calls to show. This is equivalent to doing
   get_current_fig_manager().canvas.draw(), but takes less typing :slight_smile:

* support for py2exe - see
   http://matplotlib.sf.net/py2exe_examples.zip

* New finance demo shows off many of the features of matplotlib - see
   screenshot at
   http://matplotlib.sf.net/screenshots.html#finance_work2

* new matplotlib.matlab command 'rc' for dynamic control of rc
   parameters. See
   http://matplotlib.sf.net/matplotlib.matlab.html#-rc and example
   http://matplotlib.sf.net/examples/customize_rc.py

* Andrew Straw submitted a dynamic_image example. The wx version is
   still in progress and has some flicker problems, but the gtk version
   is pretty cool -
   http://matplotlib.sf.net/examples/dynamic_image_gtkagg.py

* Bug fixes: dynamic_demo_wx, figure legends, memory leaks, axis
   scaling bug related to singleton plots, mathtext bug for '6', some
   numarray bug workarounds

See http://matplotlib.sf.net/CHANGELOG for details

Downloads at http://sourceforge.net/projects/matplotlib

Enjoy!
JDH

Hi,
I try to benchmark some modif I did to speed up Agg rendering
(basically, avoid re-creation of an Agg renderer if draw is called
without changing previous fig size and DPI)...
To do so, I changed the dynamic_image demo to use TkAgg (except my fltk
backend, it's the only one working on my workstation for the moment, I
do not have Wx not GTK).
First tests shows no improvement :-(, but in fact I can not reproduce
the speed mentioned when you discussed this demo (4 FPS or 10 FPS), only
got 0.9 FPS.

I thus tryed to check why I got such slow animation, and the results are
as follow (I use the current CVS matplotlib, with numarray):

  Example with no drawing (manager.canvas.draw commented out in the
updatefig method) : stabilize around 50 FPS, this is the best we can
hope using numarray which is, I think, the only limitting factor in this
case)...

  Example with call to tkagg.blit but no Agg canvas drawing (done
replacing the draw method in FigureCanvasTkAgg, see below * ): stabilize
around 19 FPS

  * old draw:
   def draw(self):
      FigureCanvasAgg.draw(self)
      tkagg.blit(self._tkphoto,self.renderer._renderer, 2)
      self._master.update_idletasks()
    new version:
   def draw(self):
      try:
     tkagg.blit(self._tkphoto,self.renderer._renderer, 2)
      except:
         FigureCanvasAgg.draw(self)
         tkagg.blit(self._tkphoto,self.renderer._renderer, 2)
      self._master.update_idletasks()

  Example with Agg canvas drawing + blitting: (normal TkAgg backend):
    stabilize around 1 FPS

  It seems thus that Agg drawing is the main limiting factor here, all
the tricks to avoid using strings (or reallocating Agg renderer, for
that matter) are not too usefull...
What I do not understand is why I got such low values, compared to the 4
or 10 FPS: I guess, given the impact of Agg drawing, all the *Agg
backends should have about the same speed...Is there something I miss
here?
My workstation is not current top of class, but it's a PIV 2.3 GHz, so
certainly not slow either...I do not think the graphic subsystem is at
fault, cause except for a mistake of my part, blit only test shows that
Agg is really the origin of the poor FPS...

Any idea about this?

Thanks,

Best regards,

Greg.

···

----
Dynamic_image_tkagg.py
----
#!/usr/bin/env python
"""
An animated image
"""
import sys, time, os, gc
from matplotlib import rcParams
import matplotlib
matplotlib.use("TkAgg")
from matplotlib.matlab import *
import Tkinter as Tk

fig = figure(1)
a = subplot(111)
x = arange(120.0)*2*pi/120.0
x = resize(x, (100,120))
y = arange(100.0)*2*pi/100.0
y = resize(y, (120,100))
y = transpose(y)
z = sin(x) + cos(y)
im = a.imshow( z, cmap=cm.jet)#, interpolation='nearest')

manager = get_current_fig_manager()
cnt = 0
tstart = time.time()

class loop:
    
    def __init__(self, master):
        self.master = master
        self.updatefig() # start updating
        
    def updatefig(self):
        global x, y, cnt, start
        x += pi/15
        y += pi/20
        z = sin(x) + cos(y)
        im.set_array(z)
        manager.canvas.draw()
        cnt += 1
        if not cnt%20:
            print 'FPS', cnt/(time.time() - tstart)
        self.master.after(1, self.updatefig)

cnt = 0

loop(manager.canvas._tkcanvas)
show()