You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fill_between incorrect with log y-axis and value 0 #8623
The polygon created by fill_between somehow connects the last and first point, resulting in a completely incorrect patch:
Expected outcome
I was expecting / hoping that the band would be filled correctly and simply clipped (i.e. the result I get when changing the last y1 value from 0 to e.g. 1e-10). In the plot, the blue fill should be between the red and green line.
Matplotlib version
This is with Matplotlib 2.0.0.
(on Macports, but I don't think that matters)
Slightly abstractly, y=0 is mapped to x = -infinity on a log scale, so I would expect the fill between to be clipped at the vertical line x=4 in the above example, and for the x=5, y=0 point to be ignored.
When creating the issue I forgot to mention #7371 .
I don't quite follow the discussion there, but it might be relevant to decide what to do here.
For me, any solution that doesn't have this issue that the last y1 point connects to the first y2 point would be fine.
Also, if someone else has this issue, I wanted to mention that it's possible to work around the issue using where and filtering out the non-positive y values:
@Tuan333 - Yes, indeed nonposy='clip' resolves the issue, thanks for pointing it out.
The main remaining issue is that we have to teach our users about it, because if they call plt.loglog without that option after calling the plotting functions from our package, they will still see that issue.
Close this issue?
Or is there anything that can be improved on the matplotlib side (e.g. change default behaviour)?
Activity
dstansby commentedon May 15, 2017
Confirmed on master, thanks for the code sample.
dstansby commentedon May 15, 2017
Slightly abstractly,
y=0is mapped tox = -infinityon a log scale, so I would expect the fill between to be clipped at the vertical linex=4in the above example, and for thex=5, y=0point to be ignored.cdeil commentedon May 15, 2017
@dstansby - Thanks for looking into the issue!
When creating the issue I forgot to mention #7371 .
I don't quite follow the discussion there, but it might be relevant to decide what to do here.
For me, any solution that doesn't have this issue that the last
y1point connects to the firsty2point would be fine.Also, if someone else has this issue, I wanted to mention that it's possible to work around the issue using
whereand filtering out the non-positive y values:This is what I'm doing for now.
cdeil commentedon Jul 3, 2017
@Tuan333 - Yes, indeed
nonposy='clip'resolves the issue, thanks for pointing it out.The main remaining issue is that we have to teach our users about it, because if they call
plt.loglogwithout that option after calling the plotting functions from our package, they will still see that issue.Close this issue?
Or is there anything that can be improved on the matplotlib side (e.g. change default behaviour)?
anntzer commentedon Jul 3, 2017
Probably related to #8537?
dstansby commentedon Jul 3, 2017
tacaswell commentedon Jul 5, 2017
@dstansby Won't #8836 make this worse (by changing more things to mask rather than clip)?
dstansby commentedon Jul 6, 2017
I don't think it'll make it worse than the image in the original bug report, but it certainly doesn't fix it.
afvincent commentedon Nov 1, 2017
Currently, the MWE results in

with Matplotlib from master (
2.1.0.post476+g30b58001f). (The issue is still present with Matplotlib 2.1 from conda)@tacaswell @anntzer
Should we close this issue (didn't #9477 fixed it?)?
tacaswell commentedon Nov 1, 2017
I think this is fixed by #9477