Skip to content

imshow() pixelization in matplotlib 2.0.2 but not in 2.0.0 #8723

Closed

Description

@diogoff

I'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:
matplotlib

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?

Activity

  1. WeatherGod commented on Jun 6, 2017

    @WeatherGod
    Member
  2. WeatherGod commented on Jun 6, 2017

    @WeatherGod
    Member
  3. diogoff commented on Jun 6, 2017

    @diogoff
    Author

    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()
    

    matplotlib

  4. WeatherGod commented on Jun 6, 2017

    @WeatherGod
    Member
  5. diogoff commented on Jun 6, 2017

    @diogoff
    Author

    The pixelization appears around the negative values which are being clipped by vmin=0.

  6. WeatherGod commented on Jun 6, 2017

    @WeatherGod
    Member
  7. diogoff commented on Jun 6, 2017

    @diogoff
    Author

    It seems that when those (negative) pixels are being clipped, the interpolation no longer works as it used to.
    Thanks for your help.

  8. WeatherGod commented on Jun 6, 2017

    @WeatherGod
    Member
  9. dstansby commented on Jun 15, 2017

    @dstansby
    Member

    Yep, this bisects to 1a7c4ef

  10. tacaswell commented on Jun 17, 2017

    @tacaswell
    Member

    This is a duplicate of #8631 which has a proposed solution in the comments.

  11. added this to the milestone on Jun 17, 2017
  12. added
    Release criticalFor bugs that make the library unusable (segfaults, incorrect plots, etc) and major regressions.
    on Jun 17, 2017
  13. self-assigned this
    on Jul 25, 2017
  14. tacaswell commented on Aug 31, 2017

    @tacaswell
    Member

    Closed by #8966

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Release criticalFor bugs that make the library unusable (segfaults, incorrect plots, etc) and major regressions.status: duplicate

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions