-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Force clipped-log when drawing log-histograms. #9305
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
Interesting. Could we push this up to the Artist level? Tagged an 2.1.1, but I suspect that the safest thing will be to revert the default and hold something like this for 2.2. |
As wrote in the comment I was really hoping to put this at the level of BarContainer but that guy has no control over drawing :-( so I put it at the lowest possible level. Edit: But I guess the same mechanism can be helpful for log-scale errorbars that go below zero (not that they're particularly physically meaningful but I'm sure we're going to get a bug report about that...). Edit^2: Now also implemented for log-scale errorbars and fill_between, and added tests. |
b493791
to
ffc2186
Compare
ffc2186
to
957a5a1
Compare
Looking at this again, I feel that the correct behavior is indeed to clip by default. However, the clipping should not be done by the scale machinery. Instead, it should be done at the renderer stage: when then renderer gets a point at If it were only up to me, I would even suggest doing this independently of the scales machinery, so that even in linear scales, something like See also #9477 which implements something similar, which I think works better than the strategy of this PR. |
I also like #9477 better. 👍 for supporting |
You realize that would be a major change in behavior, right? 😉 |
There is a question of how wrong the slope will be for |
Closing in favor of #9477 |
For The main question is what to do with (inf, inf). Realistically, this can either be treated as nan, or as a point infinitely away at an angle of 45°. I think I mildly favor the second posibility, as this allows e.g. filling [(0, 0), (0, inf), (inf, inf), (inf, 0)] to mean the positive quadrant, but I could easily be convinced otherwise. |
Fixes #9288 & #9457 .
Note that because the clipping occurs only at draw time, the autolimits are simply picked using the nonzero values (at the time the autolimits are computed, clipping is not in effect) (so the autolimits are going to be a little bit different but I am happy with relying on the margins system to handle them).
If we go this route we may ultimately want to strip out the special casing of log-scale plots on bar().
Also need to decide whether we want to allow force-clipping both x and y.
I would prefer not making this a public API for now :/
Edit: I think #9477 is a better fix.
PR Summary
PR Checklist