SVG and pdf

Hi!

This may be a pdf issue or an SVG issue and have nothing to do with matplotlib.
If so, sorry...

Whenever I produce a figure with matplotlib and 'crop it' using the axis command
the svg comes out fine. However, when I save this svg to pdf using inkscape's
'cairo' backend the part of the data that was 'cropped' becomes visible in the
pdf. e.g. if I had plotted data from x = -2 to +10, and then I set the axes to
only show the data from +3 to +6, the svg comes out fine, but the pdf shows the
rest of the graph leaking out from the axes.

I currently have to manually crop my data to prevent this.

Thanks!
-K

Sounds like a Inkscape/Cairo issue to me, if the PDF it converts doesn't match the SVG. That said, SVG is tricky to get right, and we may be able to produce things in a different way that Inkscape will handle correctly. I'll look into this and file a bug with Inkscape and/or Cairo if it turns out to be a bug on their end.

Does directly outputting the PDF from matplotlib work as a workaround?

Cheers,
Mike

Kaushik Ghose wrote:

···

Hi!

This may be a pdf issue or an SVG issue and have nothing to do with matplotlib.
If so, sorry...

Whenever I produce a figure with matplotlib and 'crop it' using the axis command
the svg comes out fine. However, when I save this svg to pdf using inkscape's
'cairo' backend the part of the data that was 'cropped' becomes visible in the
pdf. e.g. if I had plotted data from x = -2 to +10, and then I set the axes to
only show the data from +3 to +6, the svg comes out fine, but the pdf shows the
rest of the graph leaking out from the axes.

I currently have to manually crop my data to prevent this.

Thanks!
-K

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Hi Mike,

Sounds like a Inkscape/Cairo issue to me, if the PDF it converts doesn't match the SVG. That said, SVG is tricky to get right, and we may be able to produce things in a different way that Inkscape will handle correctly. I'll look into this and file a bug with Inkscape and/or Cairo if it turns out to be a bug on their end.

Thanks!

Does directly outputting the PDF from matplotlib work as a workaround?

Yes, it works just fine. And importing this pdf to Inkscape works fine too! So that would be a convenient way to go.

Thanks!
-K

···

Hi!

This may be a pdf issue or an SVG issue and have nothing to do with matplotlib.
If so, sorry...

Whenever I produce a figure with matplotlib and 'crop it' using the axis command
the svg comes out fine. However, when I save this svg to pdf using inkscape's
'cairo' backend the part of the data that was 'cropped' becomes visible in the
pdf. e.g. if I had plotted data from x = -2 to +10, and then I set the axes to
only show the data from +3 to +6, the svg comes out fine, but the pdf shows the
rest of the graph leaking out from the axes.

I currently have to manually crop my data to prevent this.

Thanks!
-K