I didn't write the first pass of SVG support, that was done before I got involved -- I'm not sure who to credit, but he or she deserves most of it.
I did add the feature that's causing grief here -- the embedding of character outlines directly in the SVG file.
I've committed a change in SVN (both the trunk and the branch) that should resolve your problem. I've written the inkscape mailing list about the "correct" solution, but I figure we need a workaround in mpl regardless.
If you're not tracking SVN, you can replace your copy of backend_svg.py with this one, and it should *probably* work:
Kaushik Ghose wrote:
Ah, such prompt, friendly and knowledgeable help!
You're the guy implementing svg support in matplotlib, right? Thanks so much for implementing this!!!
If I can do anything to assist please tell me.
Michael Droettboom wrote:
When matplotlib outputs an SVG, each unique character is assigned a numeric id (these are just assigned in order), and inserted as a "def", and then "use"d (referenced) wherever they are used.
When you paste on SVG into another, those names clash, and Inkscape is pulling in the wrong characters when it goes to draw.
Now, my gut feels that this is actually a bug in Inkscape -- pasting of referenced objects from one file into another should reassign new ids. However, I'm not an SVG expert, so I could be wrong, but I think I will take this question over to the Inkscape mailing list anyway.
That said, there are probably some workarounds that matplotlib could make (using a hash of the character's content as the id, for instance). I'll look into that and reply when progress has been made.
Kaushik Ghose wrote:
I have a peculiar problem, and I wonder if anyone can assist me.
I have two figures generated from matplotlib and saved as svgs. They both print fine, and they load in Inkscape just fine.
However, when I copy one figure and paste it into the other, the pasted figure's labels and text become garbled.
Screenshots on this page
Any suggestions would be most welcome
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
Matplotlib-users mailing list
Science Software Branch
Operations and Engineering Division
Space Telescope Science Institute
Operated by AURA for NASA