-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Bug with PatchCollection in PDF output #1860
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
Confirmed. I've updated the title since this is explicitly a Collection issue. Adding the patch to the axes doesn't have this problem (It works as expected). |
Even more explicitly, I think the problem is with the match_original keyword to
Also solves the problem. |
Thanks for the workaround! In case anyone else has this issue, I found a slightly improved workaround, if one wants to keep all the other attributes (edgecolor, etc.) which is just to keep
|
Interestingly with the pdf backend the line's alpha is bound to the alpha of the face color, i.e.:
produces a circle with a green line, but the line has an alpha of 0.1. This is not the behaviour with Agg. |
FWIW, changing the following helped remove the circle, though I don't fully understand the impacts:
|
An interesting data-point, this bug does not happen in v1.1.1. |
This arises because:
I'm not sure how to fix this yet, but I thought that might be illuminating. There is a broader bug here which is that collections can not have different alphas for different instances of the same reused object. Since 1.1.1 was working, I'll try a |
FWIWI, git bisect points at 4dd3de1. |
The fact that this can be worked around by doing |
That workaround only works if all of the collection items are to have no fill. If the collection mixes filled and unfilled, we'd still have this problem. |
…d correctly in the PDF backend. Also fixes a related bug that alpha could not be set on individual members of a collection.
I believe the attached patch fixes the issue. @astrofrog: Can you confirm? |
The patch by @mdboom looks good to me on a first read. The logic for handling transparency correctly seems to be pretty complicated. It's probably partially because the Agg and PDF rendering models are not quite the same, but I can't help wondering if there isn't something that we could do in the frontend to simplify it. |
In a first pass, I tried to create a separate |
Out of interest, what does the output look like with a PDF generated with the cairo backend? |
@dmcdougall : Good question. The Cairo output is correct, but that's mainly because it doesn't do any optimizations (reusing of path objects in a collection). |
@mdboom - this patch works for me - thanks for the quick fix! |
👍 from me. Looks like a good fix with a good test. All that is missing is some documentation for the change 😉 |
@pelson: as you wish 😉 |
😄 thanks @mdboom |
Bug with PatchCollection in PDF output
…d correctly in the PDF backend. Also fixes a related bug that alpha could not be set on individual members of a collection.
The following script:
Produces the following figure:
so it looks like there is something weird going on - the circle is cutting a hole through the image! This is with the latest dev version, but I think the bug affects 1.2.1 too.