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

On 03/19/2012 12:46 PM, Sebastian Ohl wrote:
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)




------------------------------------------------------------------------------
This SF email is sponsosred by:
Try Windows Azure free for 90 days Click Here
http://p.sf.net/sfu/sfd2d-msazure


_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

------------------------------------------------------------------------------
This SF email is sponsosred by:
Try Windows Azure free for 90 days Click Here 
http://p.sf.net/sfu/sfd2d-msazure
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to