-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Fill color is always opaque in the pdf backend if there is a hatch pattern #3841
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
Comments
punting to 1.4.x, this isn't going to get done immediately and I don't want to block 1.4.3 on this. Any protests? |
I think punting is fine -- I'm just noticing this now and might have some time to look at it soon, but don't let this hold you up. |
I just ran into this as well. Is there any sort of workaround? I guess I could just save as png and include the figure I'm having issues with as a raster image in my paper. |
I'm seeing the same thing in the png as in the pdf. I suspect the reason you are seeing them differently is that the hatch pattern is quite fine, so in conjunction with antialiasing, it is lightening most of the pixels. This is seen most clearly when you zoom in. |
ping @jkseppan |
I think I see the problem: the hatch pattern stream does not set alpha parameters, which in PDF requires using an ExtGState dictionary. If I hand-edit the PDF file so that the pattern stream refers to the page's ExtGState dictionary and sets the relevant state, the output color looks closer to the PNG file. But note those horizontal and vertical lines, which occur at one-inch intervals, at least when viewed in Apple's Preview.app. I don't think we can get a good result when filling with a transparent color if we use tiling patterns, like all the PDF hatch patterns currently are (cf. #1188). |
The operations of filling with a color and filling with a hatch pattern are done with the same operator in pdf, and unfortunately the pdf backend has an inbuilt assumption that we do at most one of these. When we do both, the background color is included in the fill pattern, which is a mistake - we should be able to do both operations independently. |
Moved out of 1.5 milestone as this sounds like it might require major work to the pdf backend? |
Any updates on this other than punting to 2.1? |
I do not believe so. It looks like the hatch is written out by a method pull requests are always welcome! |
In what directory is |
https://github.com/matplotlib/matplotlib/blob/master/lib/matplotlib/backends/backend_pdf.py On Mon, May 9, 2016 at 11:50 PM balterman notifications@github.com wrote:
|
This issue has been marked "inactive" because it has been 365 days since the last comment. If this issue is still present in recent Matplotlib releases, or the feature request is still wanted, please leave a comment and this label will be removed. If there are no updates in another 30 days, this issue will be automatically closed, but you are free to re-open or create a new issue if needed. We value issue reports, and this procedure is meant to help us resurface and prioritize issues that have not been addressed yet, not make them disappear. Thanks for your help! |
Just tested with:
and this seems to be solved. See the attached PNG and PDF below. |
Sounds good! Although not really clear what fixed it. There is a PR #17049 that is "almost done" which would fix it. Plus that there are some issues where different PDF renderers show the information differently. I'll leave it open and then we can possibly close it once we are certain that it is fully fixed and which PR did it. |
This issue has been marked "inactive" because it has been 365 days since the last comment. If this issue is still present in recent Matplotlib releases, or the feature request is still wanted, please leave a comment and this label will be removed. If there are no updates in another 30 days, this issue will be automatically closed, but you are free to re-open or create a new issue if needed. We value issue reports, and this procedure is meant to help us resurface and prioritize issues that have not been addressed yet, not make them disappear. Thanks for your help! |
I've posted this issue on StackOverflow as: http://stackoverflow.com/questions/27094747/
The basic problem is that transparency information isn't being correctly to PDFs when hatching is used.
I'm running in OS X (Yosemite) with the default MacOSX matplotlib backend and using matplotlib 1.4.1. Is there any reason why this setup should fail to produce transparent PDF output? This used to work in the past (with OS X Mavericks and an earlier version of matplotlib) but I'm not sure exactly what change has caused this problem.
If the following code is run, the problem can be seen in with_hatch.pdf, but not in any of the other output files.
The text was updated successfully, but these errors were encountered: