New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Perfectly horizontal or vertical lines don't render to svg #991
Comments
I get the same behaviour when viewing the svg produced in Safari on master. To help diagnosis, how are you viewing the produced SVG? |
I also viewed the SVG in Safari when I found the issue. |
Another interesting thing to note: for the project I am doing I need to use zorder to put some things on top of others. When I export to svg and view in safari, the z order does not appear to have been followed and the wrong things are on top.When I export to png or view in Inkscape everything is in the right layer. |
Most likely a bug in safari (a snapping issue, maybe?). I can view your example just fine in Firefox. Just curious, would setting a larger linewidth for the line make a difference in safari? |
Probably a bug in WebKit, as it happens in Chrome, too: |
This is a problem upstream and there is no action for mpl as far as I can see. Should we document this somewhere? I've labelled it "doc", but if there is nothing to be done, we can close. @amauboussin: Thanks for raising this, it is well worth knowing about! |
Chrome 33 no longer seems to have this bug. Safari 7 does. |
Closing - there is nothing for us to do here but wait for browsers to fix their bug. |
For what it is worth, I have different users (of SageMathCloud) who hit this bug constantly and report it to me. If any matplotlib experts had an idea for a workaround (even something horrible and crappy like slightly peturb the line), I would be interested... Even adding a link in this thread about how to complain to apple about this would be nice (?). |
One way to report bugs to Apple is to join their beta-tester program [1] and to test development versions of OS X. You get a "Feedback Assistant" app which lets you report bugs. Last year I beta-tested OS X 10.10 Yosemite and I reported the Safari svg bug (horizontal and vertical lines not rendered) via the Feedback Assistant but that did not result in any fix. I just re-enrolled to the beta-tester program for OS X 10.11 El Capitan and I'll report the bug again. I created a page to display the bug [2]. Feel free to link to that page. Comments welcome. [1] https://beta.apple.com/ |
@slel: Thanks. As for workarounds: @williamstein's suggestion to slightly perturb the line is interesting. I suppose we should experiment with how much skew would be required and how badly that looks. The downside, of course, is that degrades the plot for everyone. (Unfortunately, I don't have access to a Mac this week to play -- anyone else is welcome to.) We could attach a small amount of Javascript to the SVG that detects the browser and displays a warning (and a suggestion to switch to Chrome or Firefox) if it's one of the known broken browsers... |
The bug is fixed in WebKit. And thus in Safari 9. |
I am strongly 👎 on adding skew to work around bugs in external libraries. Does this issue depend on line width? |
Perfectly horizontal or vertical lines do not show up in svgs on my machine. Could be an issue with my specific setup, I am curious if anyone else can reproduce the issue.
Here is the code that causes the bug for me:
import pylab as plt
plt.plot([-1,1],[1,1]) #perfectly horizontal line does not render
plt.savefig('/Users/Andrew/Desktop/plot.svg', format='svg')
Here is a workaround I found:
import pylab as plt
plt.plot([-1,1],[1,1.001]) #not a perfectly horizontal line; renders
plt.savefig('/Users/Andrew/Desktop/plot.svg', format='svg')
My environment:
Matplotlib 1.10 on Mac OS X 10.7 obtained from Enthought
The text was updated successfully, but these errors were encountered: