-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Polygon is corrupted with SVG backend in a certain condition #1751
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
Conversation
I can confirm this on current master. It looks fine with agg. |
@efiring It looks like you wrote the commit in question. |
This might be a tough one. I can't spend more time on it now. The situation can be seen more clearly with the following test script:
In the case that fails, the last point is being ignored; I don't know whether it is ignored before the svg is written, or whether information is written to the svg file but is ignored by the renderer. |
@mdboom, will you be able to take a look at this? What I find is that in the "not OK" case, where the polygon starts at the upper left, the svg path element is
and in the last OK case it is
So, in the case that is failing, the svg is getting a closed path with only 3 vertices instead of a clipped (open) path with two disconnected line segments. This second one doesn't seem quite right, either; the second segment has two "L" vertices, and I don't think the last one belongs there. Maybe it is all simpler than it seems, but I have to suspect something is going wrong in the depths of C++ where I rapidly drown. |
I think I have a fix for this. Just running the tests now. Stay tuned. |
Annoyingly this slipped through the crack for 1.4.1 |
BUG : Polygon is corrupted with SVG backend in a certain condition
Hi.
I found a path of Polygon is somewhat corrupted when save a figure as SVG. I have an imshow() an image and add a rectangle-like Polygon. Since I only need the edges of the Polygon, I set 'facecolor' to 'none'. The height of the Polygon is larger than the height of the image. When I saved the figure as SVG, the path of the Polygon is corrupted.
Interestingly, the problem occurs only when height of the figure is smallar then 3.3 (while keeping the width to 6.0), and when 'facecolor' of the Polygon is 'none'. The code at the bottom reproduces the problem.
I'm using the current master branch from github, and found the problem was introduced between v1.1.1 and v1.2.0. After bisecting between them, I found that the problem is introduced in c6cc861.
Thanks,