Refreshing an image from imshow after set_data()

Jo?o> Hello all, I'm making a small visualization application
    Jo?o> based on matplotlib which is in turn embedded in gtk2 using
    Jo?o> pygtk. The code goes like this:

    Jo?o> fig = matplotlib.figure() ax = fig.add_subplot(111) im =
    Jo?o> ax.imshow(A) canvas = FigureCanvas(fig) [...]

    Jo?o> and it works fine. However, after an user action I need to
    Jo?o> update the image, and so I do a

    Jo?o> im.set_data(NewData)

    Jo?o> but the image remains unchanged, and will only update if I
    Jo?o> somehow move it using the toolbar. I googled a bit and found
    Jo?o> that perhaps fig.draw(renderer) would work, but I have no
    Jo?o> idea as how to get a reference to the renderer. Any ideas?

call canvas.draw() which creates the renderer and calls
fig.draw(renderer). The segregation between the canvas and the figure
was done precisely to decouple the backend (eg renderer) from the
frontend (eg figure).

See examples/dynamic_image_gtkagg.py for an example of how to
dynamically update the gtkagg canvas.

JDH