You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've been noticing lately that matplotlib's SVG output appears with incorrect clipping in a lot of SVG viewers (rsvg-view, Ristretto, gpicview), even though it does appear correctly in good SVG viewers like inkscape, firefox, chrome. The data curves peek outside of the axes. Luckily there is an fix in matplotlib that should be easy enough to implement:
Currently, the SVG structure looks more or less like this, with the clipPath defined at the end:
I found that if I simply moved the section containing that clipPath earlier in the file, then the SVG views just fine in any viewer that I can find. I guess that these basic SVG viewers don't like forward references.
Unfortunately, it's not so simple. The SVG backend currently works in streaming mode, meaning it writes the file in a single pass. This is important for performance reasons when running inside a webserver, for example. We need to find a solution that doesn't involve multiple passes of the output.
Since there is nothing against forward references in the SVG spec, I think the failing viewers are violating the spec and should be fixed (if possible) accordingly. rsvg (on which all of the tools you listed are based, IIRC) has never been the best tool for SVG rendering, and it has a number of other bugs as well.
Hmm, I thought so, but is it possible to write the axis clipping area before writing the lines? Since it's known beforehand, I mean.
Anyway, if it's not an easy fix, it certainly shouldn't be your burden to have to make workarounds for rsvg. (I didn't know all the viewers were all based on that, makes sense.) Spend your time on keeping matplotlib the best 2D plotting environment ever, and I'll go bug the rsvg guys instead. :P
I've been noticing lately that matplotlib's SVG output appears with incorrect clipping in a lot of SVG viewers (rsvg-view, Ristretto, gpicview), even though it does appear correctly in good SVG viewers like inkscape, firefox, chrome. The data curves peek outside of the axes. Luckily there is an fix in matplotlib that should be easy enough to implement:
Currently, the SVG structure looks more or less like this, with the clipPath defined at the end:
I found that if I simply moved the section containing that clipPath earlier in the file, then the SVG views just fine in any viewer that I can find. I guess that these basic SVG viewers don't like forward references.
For examples, this works:
I would attach an example SVG but github doesn't seem to support that...
The text was updated successfully, but these errors were encountered: