GeezerVison is showing github.com — imshow() pixelization in matplotlib 2.0.2 but not in 2.0.0 · Issue #8723 · matplotlib/matplotlib
imshow() pixelization in matplotlib 2.0.2 but not in 2.0.0 #8723DescriptionI'm plotting the same image (a numpy float32 array) with imshow(..., interpolation='bilinear') on matplotlib 2.0.0 and 2.0.2.
Click to see in full:

On 2.0.0 the image is perfectly smooth. However, on 2.0.2 there are noticeable pixelization effects.
Has imshow() changed between these two versions? ActivityWeatherGod commented on Jun 6, 2017 There have been some bugfixes, IIRC, mostly related to the handling of NaNs
and masked points. Are there any in your data?
…WeatherGod commented on Jun 6, 2017 Another possible source of issues *might* be colormap handling. It would be
helpful to have a minimum working example to investigate with.
…
On Tue, Jun 6, 2017 at 11:23 AM, Benjamin Root ***@***.***> wrote:
There have been some bugfixes, IIRC, mostly related to the handling of
NaNs and masked points. Are there any in your data?
On Tue, Jun 6, 2017 at 10:54 AM, diogoff ***@***.***> wrote:
> I'm plotting the same image (a numpy float32 array) with imshow(...,
> interpolation='bilinear') on matplotlib 2.0.0 and 2.0.2.
>
> See the following figure:
> [image: matplotlib]
> < https://cloud.githubusercontent.com/assets/7391155/26835386/20980584-4ad0-11e7-8719-83beec5126d5.png>
>
> On 2.0.0 the image is perfectly smooth. However, on 2.0.2 there are
> noticeable pixelization effects.
>
> Has the imshow() routine changed?
>
> —
> You are receiving this because you are subscribed to this thread.
> Reply to this email directly, view it on GitHub
> < #8723>, or mute the
> thread
> < https://github.com/notifications/unsubscribe-auth/AARy-PvqiPeroQYvc-abNuKTIJk7LZINks5sBWhDgaJpZM4Nxdr0>
> .
>
diogoff commented on Jun 6, 2017 Here is a MWE:
import matplotlib.pyplot as plt
data = [[ 0.001071, 0.032820, 0.105207, 0.127595, 0.147364, 0.124911, 0.073015, 0.000074, -0.003899, -0.001462],
[ 0.000787, 0.031720, 0.107091, 0.183722, 0.202479, 0.204296, 0.154234, 0.085757, 0.026941, -0.003271],
[ 0.001480, -0.000771, 0.016654, 0.214761, 0.278136, 0.304099, 0.246056, 0.169364, 0.085205, -0.001907],
[ 0.000549, -0.000475, 0.001674, 0.247847, 0.345098, 0.378256, 0.332674, 0.229220, 0.133641, 0.053745],
[ 0.000000, 0.002675, 0.001689, 0.266309, 0.414319, 0.459767, 0.425990, 0.317280, 0.190170, 0.099265],
[ 0.000000, 0.001037, -0.002923, 0.254976, 0.408347, 0.529809, 0.532195, 0.406330, 0.272445, 0.163764],
[ 0.000000, 0.000792, -0.013151, 0.216619, 0.397671, 0.567617, 0.616055, 0.508699, 0.379961, 0.263546],
[ 0.000000, 0.002062, -0.016293, 0.157240, 0.368229, 0.613702, 0.712611, 0.639131, 0.505910, 0.338813],
[ 0.000000, 0.001741, 0.003448, 0.100818, 0.333026, 0.611874, 0.787059, 0.773407, 0.644049, 0.450520],
[ 0.000000, -0.001268, -0.008104, 0.061512, 0.294558, 0.604565, 0.814691, 0.865676, 0.776763, 0.557480],
[ 0.000000, -0.001105, -0.002768, 0.036252, 0.252868, 0.544436, 0.775150, 0.920004, 0.890915, 0.690601],
[ 0.000000, -0.001123, -0.003589, 0.028705, 0.194056, 0.471003, 0.728520, 0.921639, 0.969436, 0.773769],
[ 0.000000, -0.000430, -0.004625, 0.017730, 0.149156, 0.423797, 0.677714, 0.912435, 0.984722, 0.846838],
[ 0.000000, 0.000000, -0.002619, 0.036928, 0.136544, 0.410567, 0.666038, 0.905706, 0.942078, 0.894590],
[ 0.000000, -0.000296, -0.003399, 0.050115, 0.189001, 0.451915, 0.696602, 0.869335, 0.893818, 0.826647],
[ 0.000000, 0.000174, -0.003604, 0.083219, 0.248855, 0.517874, 0.739961, 0.843343, 0.803800, 0.718687],
[-0.001720, 0.005825, 0.078039, 0.154466, 0.324385, 0.550980, 0.745479, 0.817428, 0.750877, 0.624806],
[ 0.000719, -0.004020, 0.118178, 0.218264, 0.395383, 0.585784, 0.748400, 0.744401, 0.620376, 0.464464],
[ 0.003257, 0.066374, 0.142013, 0.270861, 0.458675, 0.621705, 0.691592, 0.590108, 0.491103, 0.346859],
[ 0.042411, 0.111464, 0.193880, 0.308119, 0.475352, 0.602842, 0.600717, 0.487950, 0.392807, 0.258806]]
plt.imshow(data, vmin=0., vmax=1., interpolation='bilinear')
plt.axis('off')
plt.show()

WeatherGod commented on Jun 6, 2017 It is almost like it is treating those zeros as masked out, isn't it?
attn: @tacaswell
…
On Tue, Jun 6, 2017 at 5:08 PM, diogoff ***@***.***> wrote:
Here is a MWE:
import matplotlib.pyplot as plt
data = [[ 0.001071, 0.032820, 0.105207, 0.127595, 0.147364, 0.124911, 0.073015, 0.000074, -0.003899, -0.001462],
[ 0.000787, 0.031720, 0.107091, 0.183722, 0.202479, 0.204296, 0.154234, 0.085757, 0.026941, -0.003271],
[ 0.001480, -0.000771, 0.016654, 0.214761, 0.278136, 0.304099, 0.246056, 0.169364, 0.085205, -0.001907],
[ 0.000549, -0.000475, 0.001674, 0.247847, 0.345098, 0.378256, 0.332674, 0.229220, 0.133641, 0.053745],
[ 0.000000, 0.002675, 0.001689, 0.266309, 0.414319, 0.459767, 0.425990, 0.317280, 0.190170, 0.099265],
[ 0.000000, 0.001037, -0.002923, 0.254976, 0.408347, 0.529809, 0.532195, 0.406330, 0.272445, 0.163764],
[ 0.000000, 0.000792, -0.013151, 0.216619, 0.397671, 0.567617, 0.616055, 0.508699, 0.379961, 0.263546],
[ 0.000000, 0.002062, -0.016293, 0.157240, 0.368229, 0.613702, 0.712611, 0.639131, 0.505910, 0.338813],
[ 0.000000, 0.001741, 0.003448, 0.100818, 0.333026, 0.611874, 0.787059, 0.773407, 0.644049, 0.450520],
[ 0.000000, -0.001268, -0.008104, 0.061512, 0.294558, 0.604565, 0.814691, 0.865676, 0.776763, 0.557480],
[ 0.000000, -0.001105, -0.002768, 0.036252, 0.252868, 0.544436, 0.775150, 0.920004, 0.890915, 0.690601],
[ 0.000000, -0.001123, -0.003589, 0.028705, 0.194056, 0.471003, 0.728520, 0.921639, 0.969436, 0.773769],
[ 0.000000, -0.000430, -0.004625, 0.017730, 0.149156, 0.423797, 0.677714, 0.912435, 0.984722, 0.846838],
[ 0.000000, 0.000000, -0.002619, 0.036928, 0.136544, 0.410567, 0.666038, 0.905706, 0.942078, 0.894590],
[ 0.000000, -0.000296, -0.003399, 0.050115, 0.189001, 0.451915, 0.696602, 0.869335, 0.893818, 0.826647],
[ 0.000000, 0.000174, -0.003604, 0.083219, 0.248855, 0.517874, 0.739961, 0.843343, 0.803800, 0.718687],
[-0.001720, 0.005825, 0.078039, 0.154466, 0.324385, 0.550980, 0.745479, 0.817428, 0.750877, 0.624806],
[ 0.000719, -0.004020, 0.118178, 0.218264, 0.395383, 0.585784, 0.748400, 0.744401, 0.620376, 0.464464],
[ 0.003257, 0.066374, 0.142013, 0.270861, 0.458675, 0.621705, 0.691592, 0.590108, 0.491103, 0.346859],
[ 0.042411, 0.111464, 0.193880, 0.308119, 0.475352, 0.602842, 0.600717, 0.487950, 0.392807, 0.258806]]
plt.imshow(data, vmin=0., vmax=1., interpolation='bilinear')
plt.axis('off')
plt.show()
[image: matplotlib]
< https://user-images.githubusercontent.com/7391155/26851969-802a9fb4-4b04-11e7-8d29-4d49e3df3c30.png>
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
< #8723 (comment)>,
or mute the thread
< https://github.com/notifications/unsubscribe-auth/AARy-Btlf7KfBsDWGii3gi5L-MELxm0Yks5sBb-zgaJpZM4Nxdr0>
.
diogoff commented on Jun 6, 2017 The pixelization appears around the negative values which are being clipped by vmin=0. WeatherGod commented on Jun 6, 2017 you are right. It is the pixels that fall below vmin. There was some recent
work around vmin/vmax. maybe that had some unintended consequences?
…diogoff commented on Jun 6, 2017 It seems that when those (negative) pixels are being clipped, the interpolation no longer works as it used to.
Thanks for your help. WeatherGod commented on Jun 6, 2017 dstansby commented on Jun 15, 2017 tacaswell commented on Jun 17, 2017 This is a duplicate of #8631 which has a proposed solution in the comments. added this to the This milestone has been deleted milestone on Jun 17, 2017tacaswell commented on Aug 31, 2017
MetadataMetadataDevelopmentNo branches or pull requestsIssue actions
|