Skip to content

contourf hatching and saving to pdf #3023

Closed

Description

@wseviour

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.

Activity

  1. added this to the v1.4.0 milestone on Apr 29, 2014
  2. wseviour commented on May 1, 2014

    @wseviour
    Author

    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.

  3. wseviour commented on May 1, 2014

    @wseviour
    Author

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

  4. pelson commented on May 9, 2014

    @pelson
    Member

    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...

  5. modified the milestones: , v1.4.0 on May 9, 2014
  6. lzkelley commented on Jun 8, 2016

    @lzkelley
    Contributor

    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.

  7. QuLogic commented on Nov 5, 2016

    @QuLogic
    Member

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

  8. tacaswell commented on Nov 8, 2016

    @tacaswell
    Member

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

  9. added a commit that references this issue on Nov 9, 2016
    74e13fe
  10. NelleV commented on Nov 14, 2016

    @NelleV
    Member

    Closed in #7421

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions