Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork7.9k
Description
Bug report
Hatches are invisible in the output ofax.fill_between
whencolor
is specified. They are present whencolor
is absent or whenfacecolor
is used.
I found#9894 which might be related, but seems to be a much narrower
Code for reproduction
importmatplotlib.pyplotaspltf,ax=plt.subplots()ax.fill_between([0,1], [0,1],hatch="//")f.savefig("test1.png")f,ax=plt.subplots()ax.fill_between([0,1], [0,1],hatch="//",color="g")f.savefig("test2.png")f,ax=plt.subplots()ax.fill_between([0,1], [0,1],hatch="//",facecolor="g")f.savefig("test3.png")
Actual outcome
Expected outcome
I expectedtest2.png
to have black hatch marks. I think what's happening is that thecolor=
kwarg is being picked up globally by the artist and so the hatches intest2.png
are there, they just have the same green color as the background. Unfortunately I don't think any hatch metadata other than the string code gets added to the artist, so I can't check.
Havingcolor=
globally change both the face and edge color of the artist makes a certain amount of sense, and I think the hatches are mostly inheriting their attributes from the kwargs that set the edge aesthetics. So I think I understand what's happening, but it took me a long time to figure out why the hatch argument had, apparently, no effect. I'll also note that thehatch demo is using thecolor=
kwarg, but withax.bar
.
Matplotlib version
- Operating system: MacOS
- Matplotlib version: 2.2.2
- Matplotlib backend (
print(matplotlib.get_backend())
): MacOSX - Python version: 3.6
- Jupyter version (if applicable): NA
- Other libraries: NA
This is a fresh install from conda to test, but I also saw it on matplotlib 2.2.0.