FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Hatches filling an empty color contour not saved in pdf · Issue #8431 · matplotlib/matplotlib · GitHub

Repository navigation

Hatches filling an empty color contour not saved in pdf  #8431

Closed

Description

I am trying to create a contour plot with the contours filled with hatches and no color. The following example works if I save it to .png but when I save it to .pdf the output is just the axis.

import numpy as np
import matplotlib.pyplot as plt



delta = 0.025

x = y = np.arange(-3.0, 3.01, delta)


X, Y = np.meshgrid(x, y)
Z1 = plt.mlab.bivariate_normal(X, Y, 1.0, 1.0, 0.0, 0.0)
Z2 = plt.mlab.bivariate_normal(X, Y, 1.5, 0.5, 1, 1)
Z = 10 * (Z1 - Z2)


levels=[0,1]
plt.contourf(X, Y, Z/X, 
                  levels,
                  #alpha=0.5,
                  colors='none', label='AGH',
                   hatches=['\\'])

plt.tight_layout()   

plt.savefig('GitHub.pdf')
plt.show()

I am using Matplotlib2.00 in Linux, installed from source.

Activity

  1. dstansby commented on Apr 9, 2017

    Member

    Is the figure above what you expected to see when saving to a .pdf file? If so I think this is fixed on our master branch (we did a couple of patch fixes recently)

  2. andres0l1 commented on Apr 9, 2017

    Author

    Hi Dstansby! Thanks what should I do then? Update the library or what exactly? Thanks!

  3. added this to the milestone on Apr 10, 2017
  4. tacaswell commented on Apr 10, 2017

    Member

    I can confirm that this works correctly on 2.0.x. I suggest installing from git for now, 2.0.1 will be out soon with this fix.

    I have not checked, but I suspect this was fixed by f6b4a32 / #7976

  5. tacaswell commented on Apr 10, 2017

    Member

    either the master branch or 2.0.x should work.

  6. andres0l1 commented on Apr 10, 2017

    Author

    Thanks a lot!!!

  7. tacaswell commented on Apr 11, 2017

    Member

    Closing as resolved, keep an eye out for the next release.

  8. mschauer commented on Nov 30, 2017

    There are still problems on version 2.0.2 with saving hatches into pdfs. I am calling

    fill_between(xx, upper, lower, edgecolor=darkcol, facecolor=lightcol, hatch="X")
    
  9. dstansby commented on Nov 30, 2017

    Member

    2.1 is our latest release. Could you upgrade to that and let us know if there are still issues?

  10. mschauer commented on Nov 30, 2017

    I am now on 2.1.0 which fixes the problem. Thank you for the guidance.

  11. dstansby commented on Nov 30, 2017

    Member

    No problem!

  12. mschauer commented on Nov 30, 2017

    There is still something going on while saving hatches to pdf. Left the pdf, right the result of show.
    I am not sure if I am reaching the limits to mathplotlib, but to the left also the hatch became transparent.

    import matplotlib.pyplot as plt
    xx = [1,2,3,4,5]
    upper = [3,3,3,3,4]
    lower = [1,2,2,2,2]
    plt.fill_between(xx, upper, lower, edgecolor="darkred", facecolor=[0.5,0.5,0.5,0.1], hatch="X", label="as")
    plt.legend()
    plt.savefig('ups.pdf')
    plt.show()
    
  13. afvincent commented on Nov 30, 2017

    Contributor

    The problem seems to occur with Acrobat Reader but not Evince. I tested the example from above with Matplotlib 2.0.0, 2.1.0 and from the master branch (on a Linux OS with Python 3.6): every time I get transparent hatches with Acrobat Reader (9.5.5) and correct hatches with Evince.

    Worth opening a new dedicated issue?

  14. tacaswell commented on Nov 30, 2017

    Member

    @afvincent yes please

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions


      Back | FazBrowse Home | New Git URL