-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Matplotlib does not display hatching when rendering to pdf in fill_between #2229
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
Which version of matplotlib are you using? IIRC, this was a bug that was fixed after 1.2.1. |
Found this issue on 1.2.1 but i checked it now on 1.3.0rc2 and there it exists as well
Sorry for missing the version in initial post |
Confirmed. I suspect there is some logic in the pdf code which checks for a "none" color and then skips the fill section (which included hatching)... |
You are right. In matplotlib/lib/matplotlib/backends/backend_pdf.py, there is nothing filled when no facecolor is specified. I did a quick test by specifying filled manually in this case, and the result looks as expected.
|
@claria: Could you test the attached patch? |
Applying this patch against 1.3.0 fixes the issue for me. Thanks alot |
Change looks good to me. I'm guessing the travis test failures are not a coincidence, would you mind looking into this and I'd be happy to merge. |
Rebased and unit tests (hopefully) fixed. |
Matplotlib does not display hatching when rendering to pdf in fill_between
Hi,
using fill_between with hatching and specifying a edgecolor and color='none' should result in edge and hatch plotted with edgecolor
While the edge is plotted, the hatch is not plotted at all (or not visible) when output is a pdf.
This works for png output.
I assume this is a bug, since it does not occur for the fill() method
PNG


PDF
Working example:
import matplotlib.pyplot as plt
plt.fill_between([1,2,3],[0.5,0.5,0.5],[1.5,1.5,1.5], hatch='/', color='none', edgecolor='blue')
plt.savefig('test.png')
plt.savefig('test.pdf'')