problems in Inkscape with SVG exported from matplotlib

Hi Everyone,

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
http://assorted-experience.blogspot.com/2008/03/inkscape-matplotlibs-svg-one-strange.html

Any suggestions would be most welcome
Thanks
-Kaushik

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.

Mike

Kaushik Ghose wrote:

···

Hi Everyone,

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
http://assorted-experience.blogspot.com/2008/03/inkscape-matplotlibs-svg-one-strange.html

Any suggestions would be most welcome
Thanks
-Kaushik

-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users
  
--
Michael Droettboom
Science Software Branch
Operations and Engineering Division
Space Telescope Science Institute
Operated by AURA for NASA

A trick that works for me is to produce eps files with matplotlib,
import them in scribus, and then export them to svg. Then they seem to
be nicely compatible with inkscape.

-Peter

···

On Tue, Mar 25, 2008 at 11:33 PM, Kaushik Ghose <kaushik.ghose@...287...> wrote:

Hi Everyone,

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.

Peter I. Hansen wrote:

···

On Tue, Mar 25, 2008 at 11:33 PM, Kaushik Ghose <kaushik.ghose@...287...> wrote:
  

Hi Everyone,

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.
    
A trick that works for me is to produce eps files with matplotlib,
import them in scribus, and then export them to svg. Then they seem to
be nicely compatible with inkscape.
  

I wonder if you could skip a step and just use the Cairo backend to output SVG? Does that not work? It should be quite similar.

Mike

--
Michael Droettboom
Science Software Branch
Operations and Engineering Division
Space Telescope Science Institute
Operated by AURA for NASA