Problem with closing figures (pylab, 0.91.2)

Hello everyone,

I'm running matplotlib 0.91.2, python 2.5.1, under Windows, and I have the following problem:

I have a function, svgf(), that takes some xml data as input, generates a figure from it, and then saves it to a file or returns the svg data as another bunch of xml.

It appears that when I generate a polar plot, or a figure with >1 subplots, calling close() at the end does not dispose of the figure. This means that the next time svgf() is called, the new graph is drawn underneath what was already there.

I'm attaching three files:
-, containing the svgf() function,
-, which calls svgf(), and
- out.xml, some example data passed by the test_loop script to svgf().

I've tried all sorts of things to dispose of the figure at the end, including using the garbage collector to find any referents to the figure and del them, to no avail.

My Python is a bit rusty, and this is my first attempt to do something with matplotlib, so I assume the answer's probably that I'm doing something stupid; any pointers in the right direction would be a great help, as this function is going to end up inside something demo'd to The Bosses on Wednesday. :confused:

Kind regards,

André Fischer

out.xml (8.42 KB) (14.7 KB) (309 Bytes)