No clipping in svg mode

Hi,

when i have a dataset that covers an area larger than the area i want
to show in my plot, then it should be clipped to the ranges i set to the
axes (at least that is what i am expecting). when i do so and save the
plot to a png-file everything is fine. but if i save it to an svg file,
the plot is not clipped to the plot area. did i do something wrong in
the code below or is it just a bug in the svg-backend?

import matplotlib.pyplot as plt

xData = range(0,100)
yData = range(0,100)

ax = plt.axes()
ax.set_xlim(30,70)
ax.set_ylim(40,60)

plt.plot(xData,yData)
plt.savefig("test.svg", format='svg', transparent=True)
plt.savefig("test.png", format='png', transparent=True)

test.png

test.svg

···

--
Regards
Sebastian Ohl

--
Sebastian Ohl sebastian@...4030...
Kurzekampstr. 14 Tel +49 531 7998221
D-38104 Braunschweig Mobil +49 172 1837678

What are you using to view the SVG? This works for me in Inkscape,
Firefox and Google Chrome, but fails using rsvg 2.34 (which is used
by ImageMagick and emacs, for example). It seems that rsvg doesn’t
like the clip path to appear after the object that uses it, even
though this is allowed by the SVG spec. SVG compliance is pretty
spotty between different renderers, but I generally think rsvg is
one of the worst.

Mike
···

http://p.sf.net/sfu/sfd2d-msazureMatplotlib-users@lists.sourceforge.nethttps://lists.sourceforge.net/lists/listinfo/matplotlib-users

Hi Mike,

···

On 03/19/2012 06:53 PM, Michael Droettboom wrote:

What are you using to view the SVG? This works for me in Inkscape,
Firefox and Google Chrome, but fails using rsvg 2.34 (which is used by
ImageMagick and emacs, for example). It seems that rsvg doesn't like
the clip path to appear after the object that uses it, even though this
is allowed by the SVG spec. SVG compliance is pretty spotty between
different renderers, but I generally think rsvg is one of the worst.

thanks for the fast reply. actually i was using geeqie and i looks like
it is using a bad renderer. i am now using inkscape to render my svg
(not just for editing) and so far it do what i need it to do.

--
Regards
Sebastian Ohl

--
Sebastian Ohl sebastian@...4030...
Kurzekampstr. 14 Tel +49 531 7998221
D-38104 Braunschweig Mobil +49 172 1837678