-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
imshow in 2.1: color resolution depends on outliers? #10567
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
Comments
Hmm, I'm not sure about whether this is intended or not, it bisects to 12c27f3 so maybe @tacaswell will know more? |
Comment in that new code:
```
# This may introduce numeric instabilities in very broadly
# scaled data
```
Looks like we might have found that situation. The data is getting scaled
for the purposes of the AGG renderer (somewhat independent of the norm that
was specified). Unfortunately, due to some fun effects with floating point
numbers, that normalization gets very digitized when the range is very
large. I would say that this is unintentional, but I am not sure how we can
fix it, though.
…On Thu, Feb 22, 2018 at 12:03 PM, David Stansby ***@***.***> wrote:
Hmm, I'm not sure about whether this is intended or not, it bisects to
12c27f3
<12c27f3>
so maybe @tacaswell <https://github.com/tacaswell> will know more?
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#10567 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AARy-OVeKeKqxTPE6_6m-ZIB0IJ_JJ3Uks5tXZ3ogaJpZM4SPgUA>
.
|
We messed around w/ all of this for 2.1.2. #10133 W/o looking carefully, does that fix this? |
Pretty sure it does - it was a round off error that caused this, but its now been fixed for large floats. |
It didn't seem fixed when I ran the above test on the master branch. |
agreed. The image is stored as float64. You lose resolution at 2^53=9e15. I’m not sure how this worked in 2.1, but that’s the problem here. |
the rescaling is relatively recent, iirc, as part of the work to better
handle over/under/invalid.
…On Thu, Feb 22, 2018 at 4:15 PM, Jody Klymak ***@***.***> wrote:
agreed. The image is stored as float64. You lose resolution at 2^53=9e15.
I’m not sure how this worked in 2.1, but that’s the problem here.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#10567 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AARy-Chvzb8jOCgsCtG6TG-vonUm2Oreks5tXdjUgaJpZM4SPgUA>
.
|
I tried to set the dtype to float 128 fro big numbers, but I was told there is no such thing... |
Image interpolation is the bug that just keeps giving! The chain of bugs and fixes here goes:
|
It’s the same bug, it’s just that #10133 only fixed up to 10^16 or so. |
The ringing / saturation in the lower left of the test is correct. If you normalize first you are effectively clipping the impact of the outliers. |
Well, we could do something like pre-clip the data to some suitably large number around the vmin/vmax, but not 17 orders of magnitude. That should preserve both behaviours Or folks could mask their invalid data instead of passing in huge (I assume) invalid values. |
I would not assume that huge data points are automatically invalid. In our application we have values between -1 and 1 in most of the image, but it can include regions with values approaching Inf. I would find it strange to mask some of the data before plotting them. I'm also not aware that you have to do something like this in Matlab or gnuplot. |
See #10613 for a fix.... |
closed by #10613 |
Since 2.1 the effective color resolution of
imshow(x, vmin=-1, vmax=1)
seems to depend on large outliers inx
.Is this intended behavior?
Thanks for clarification!
Actual outcome

Expected outcome

Matplotlib version
The text was updated successfully, but these errors were encountered: