Skip to content

Issue plotting big endian images #6671

Closed

Description

@jenshnielsen

Originally reported by Anik Halder on the mailing list http://matplotlib.1069221.n5.nabble.com/IPython-FITS-file-plotting-problem-tp47271.html

Consider this simple example:

import matplotlib.pyplot as plt
import numpy as np

x = np.arange(10)
X, Y = np.meshgrid(x,x)
Z = ((X-5)**2 + (Y-5)**2)**0.5

plt.imshow(Z, origin = "lower")
plt.colorbar()
plt.show()

plt.figure()
plt.imshow(Z.astype('>f8'), origin = "lower")
plt.colorbar()
plt.show()

Which produces:
right
And:
wrong

This works correctly in 1.5.1 so it looks like it's a regression in 2.x

Activity

  1. added this to the milestone on Jul 1, 2016
  2. tacaswell commented on Jul 1, 2016

    @tacaswell
    Member

    I think this is a duplicate of #6394 which was fixed in #6422

  3. jenshnielsen commented on Jul 1, 2016

    @jenshnielsen
    MemberAuthor

    It sounds like that should have fixed it however I can still reproduce it with 2.0.0b1+98.gc4fa469 which I just installed.

  4. QuLogic commented on Jul 2, 2016

    @QuLogic
    Member

    It works on v1.5.x, but not v2.x. Bisect points to commit 1302606

    Author: Thomas A Caswell <tcaswell@gmail.com>
    Date:   Fri Mar 4 00:17:47 2016 -0500
    
        Merge pull request #6099 from mdboom/masked-image
    
        Fix #6069.  Handle image masks correctly
    
    :040000 040000 7daaffa94619d32e28aa44502209445b5670cc8b c5e94ccc04761d2b02be7a55bd07598dc4830236 M  lib
    :040000 040000 98a3d3dc7f7a61d7029d97f9f5e657f77cb582ec 6b646c30374dc76196d8b2b0a406d06e7f2159e2 M  src
    
  5. QuLogic commented on Jul 2, 2016

    @QuLogic
    Member

    More specifically:

    eda09124a3d262bb47405924f44cdf11853f2b1e is the first bad commit
    commit eda09124a3d262bb47405924f44cdf11853f2b1e
    Author: Michael Droettboom <mdboom@gmail.com>
    Date:   Wed Mar 2 10:46:46 2016 -0500
    
        Fix #6069.  Handle image masks correctly
    
        Alternative to #6070
    
        This works by converting the greyscale image to an RGBA image (with the
        alpha channel created correctly) prior to resizing in Agg.  This also
        removes the hack (that caused problems with over/under) where we were
        using negative values to indicate transparency.
    
    :040000 040000 7daaffa94619d32e28aa44502209445b5670cc8b ff69631973998fa2efe6a5f932b9a79f02fdd088 M  lib
    

    Also, edited top post to include creation of Z from the notebook.

  6. tacaswell commented on Jul 2, 2016

    @tacaswell
    Member

    Ok, this behavior makes sense.

    In [13]: matplotlib.cbook.safe_masked_invalid(Z.astype('>f8'), copy=True).data.dtype
    Out[13]: dtype('>f8')

    numpy is happily copy, but not forcing the data to be native. I have a PR on the way.

  7. added 2 commits that reference this issue on Jul 2, 2016
    6f4dbf8
    9d43cdb
  8. self-assigned this
    on Jul 2, 2016
  9. added 2 commits that reference this issue on Jul 2, 2016
    2b8f4d3
    e077c13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions