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

* multiple axes images with imshow using alpha blending. See

* 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

* 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

* New finance demo shows off many of the features of matplotlib - see
   screenshot at

* new matplotlib.matlab command 'rc' for dynamic control of rc
   parameters. See and example

* 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 -

* 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 for details

Downloads at


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

  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):
      tkagg.blit(self._tkphoto,self.renderer._renderer, 2)
    new version:
   def draw(self):
     tkagg.blit(self._tkphoto,self.renderer._renderer, 2)
         tkagg.blit(self._tkphoto,self.renderer._renderer, 2)

  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
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?


Best regards,



#!/usr/bin/env python
An animated image
import sys, time, os, gc
from matplotlib import rcParams
import matplotlib
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)
        cnt += 1
        if not cnt%20:
            print 'FPS', cnt/(time.time() - tstart)
        self.master.after(1, self.updatefig)

cnt = 0