Skip to content

contourf hatching and saving to pdf #3023

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

Closed
wseviour opened this issue Apr 29, 2014 · 8 comments
Closed

contourf hatching and saving to pdf #3023

wseviour opened this issue Apr 29, 2014 · 8 comments

Comments

@wseviour
Copy link

contourf hatches do not appear when saving to pdf. This is apparent in the contourf_hatching.py example, here:

http://matplotlib.org/mpl_examples/pylab_examples/contourf_hatching_01.pdf

I think something similar was mentioned in #891 and #29, but I'm not sure it was resolved.

@tacaswell tacaswell added this to the v1.4.0 milestone Apr 29, 2014
@wseviour
Copy link
Author

wseviour commented May 1, 2014

Just to add a bit more info: this mostly seems to be a problem when plotting with colors='none'. A workaround of sorts is to plot with some color map and set alpha to a very low number (but not zero) to hide the colors, though this isn't really ideal.

There are then some pdf viewer-dependent issues: there is reasonable hatching when viewed in Evince, but the transparency is not shown in Chrome, and no hatches are shown in Adobe Reader.

@wseviour
Copy link
Author

wseviour commented May 1, 2014

I think @pelson introduced contourf hatching - do you have any ideas?

@pelson
Copy link
Member

pelson commented May 9, 2014

do you have any ideas?

Not immediately no. The contour hatching is just making use of the existing patch hatching functionality, so I'm guessing the same problem exists for PDF with that too. I seem to remember that there is a difference in behaviour when plotting hatches to Agg vs the PDF backend in that the hatch colours are defined by the colors keyword argument in one but not the other, and as a result they are not being drawn in the PDF backend. This could potentially be solved by having a 2-phase draw stage which draws the patches, and then draws the hatches independently, and ideally where the color and linewidth of the hatch could be controlled as well. This would definately take some development effort to achieve, but I think it would be well worthwhile...

@lzkelley
Copy link
Contributor

lzkelley commented Jun 8, 2016

I think this is the same issue: PDF viewed in chrome also isn't showing the correct hatching with fill_between (for example, See Fig.8 or Fig.11 in http://arxiv.org/pdf/1606.01900v1.pdf --- they should be light grey instead of dark black shaded regions). I can try to produce a MWE if that would be helpful.

@tacaswell
Copy link
Member

@QuLogic
Copy link
Member

QuLogic commented Nov 5, 2016

Am I missing something, or is hatching working just fine in those examples?

@tacaswell
Copy link
Member

@QuLogic The hatches in the pdf are wrong like in #6228

QuLogic added a commit to QuLogic/matplotlib that referenced this issue Nov 9, 2016
This matches behaviour with the Agg backend.

Fixes matplotlib#3023.
Fixes matplotlib#6228.
@NelleV
Copy link
Member

NelleV commented Nov 14, 2016

Closed in #7421

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

8 participants