[Possible BUG:] SVG renderer;


I’ve just encountered the same situation with SVG rendering where I repeatedly generate a changed SVG plot and only the first time does it render properly. I traced the problem to the SVG renderer failing to include “ClipPath” information in generated SVG files after the first one, and fixed it in my case by changing backend_svg.RendererSVG to deal with _clipd as self._clipd in both its init method (i.e., initialized to {}) and its _get_gc_clip_svg method (i.e., _clipd changed to self._clipd). Just before RendererSVG is defined, _clipd is declared as a module-scope entity, and this is the problem, so comment it out…

If anyone is interested in my modified backend_svg.py please let me know where to send it.


Norm Petterson


----- Original Message -----

Haibao Tang

To: matplotlib-users@…431…ists.sourceforge.net

Sent: Monday, December 06, 2004 4:55 PM

Subject: [Matplotlib-users] [Possible BUG:] SVG renderer;

Hi, I’ve run into a problem using matplotlib renderer to generate files. My example is huge, so I implement it in another way to give the idea.

  • o - o - o - o - o - o - o - o - o - o - o - o - o - o

from matplotlib.matlab import *

def draw_box(i):
root = axes([0,0,1,1])
root.text(.2, .1, “Give me a box %02i”%i)

for i in xrange(1,10):

  • o - o - o - o - o - o - o - o - o - o - o - o - o - o

The resulting files are generated, yet except the first one, all the rest miss the bar();

BUT, if I change the format to .png, no problem exists.

Is it a bug? or am I doing it right?

Much appreciated if you can point the problem out.