{"action":"created","issue":{"url":"https://api.github.com/repos/matplotlib/matplotlib/issues/6394","repository_url":"https://api.github.com/repos/matplotlib/matplotlib","labels_url":"https://api.github.com/repos/matplotlib/matplotlib/issues/6394/labels{/name}","comments_url":"https://api.github.com/repos/matplotlib/matplotlib/issues/6394/comments","events_url":"https://api.github.com/repos/matplotlib/matplotlib/issues/6394/events","html_url":"https://github.com/matplotlib/matplotlib/issues/6394","id":154010919,"number":6394,"title":"Severe bug in ``imshow`` when plotting images with small values","user":{"login":"astrofrog","id":314716,"avatar_url":"https://avatars.githubusercontent.com/u/314716?v=3","gravatar_id":"","url":"https://api.github.com/users/astrofrog","html_url":"https://github.com/astrofrog","followers_url":"https://api.github.com/users/astrofrog/followers","following_url":"https://api.github.com/users/astrofrog/following{/other_user}","gists_url":"https://api.github.com/users/astrofrog/gists{/gist_id}","starred_url":"https://api.github.com/users/astrofrog/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/astrofrog/subscriptions","organizations_url":"https://api.github.com/users/astrofrog/orgs","repos_url":"https://api.github.com/users/astrofrog/repos","events_url":"https://api.github.com/users/astrofrog/events{/privacy}","received_events_url":"https://api.github.com/users/astrofrog/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/matplotlib/matplotlib/labels/Release%20critical","name":"Release critical","color":"ededed"}],"state":"open","locked":false,"assignee":null,"milestone":{"url":"https://api.github.com/repos/matplotlib/matplotlib/milestones/14","html_url":"https://github.com/matplotlib/matplotlib/milestones/2.0%20(style%20change%20major%20release)","labels_url":"https://api.github.com/repos/matplotlib/matplotlib/milestones/14/labels","id":662004,"number":14,"title":"2.0 (style change major release)","description":"Style changes only","creator":{"login":"tacaswell","id":199813,"avatar_url":"https://avatars.githubusercontent.com/u/199813?v=3","gravatar_id":"","url":"https://api.github.com/users/tacaswell","html_url":"https://github.com/tacaswell","followers_url":"https://api.github.com/users/tacaswell/followers","following_url":"https://api.github.com/users/tacaswell/following{/other_user}","gists_url":"https://api.github.com/users/tacaswell/gists{/gist_id}","starred_url":"https://api.github.com/users/tacaswell/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tacaswell/subscriptions","organizations_url":"https://api.github.com/users/tacaswell/orgs","repos_url":"https://api.github.com/users/tacaswell/repos","events_url":"https://api.github.com/users/tacaswell/events{/privacy}","received_events_url":"https://api.github.com/users/tacaswell/received_events","type":"User","site_admin":false},"open_issues":36,"closed_issues":288,"state":"open","created_at":"2014-05-17T14:28:22Z","updated_at":"2016-05-12T03:28:53Z","due_on":null,"closed_at":null},"comments":6,"created_at":"2016-05-10T13:48:38Z","updated_at":"2016-05-12T04:56:44Z","closed_at":null,"body":"The following minimal example:\r\n\r\n```\r\nimport matplotlib\r\nmatplotlib.use('Agg')\r\nfrom astropy.wcs import WCS\r\nfrom wcsaxes import datasets\r\nimport matplotlib.pyplot as plt\r\nhdu = datasets.fetch_msx_hdu()\r\nplt.imshow(hdu.data, vmin=-2e-4, vmax=2e-4)\r\nplt.savefig('image.png')\r\n```\r\n\r\nproduces the following output:\r\n\r\n![image](https://cloud.githubusercontent.com/assets/314716/15148599/dedc6636-16bd-11e6-83f8-a06d4c5f5757.png)\r\n\r\nThis appears to be related to the fact the values in the image data are < 1. If I multiply all the values by 1e6, I get something sensible:\r\n\r\n```\r\nplt.imshow(hdu.data * 1e6, vmin=-2e-4, vmax=2e-4)\r\nplt.savefig('image.png')\r\n```\r\n\r\n![image](https://cloud.githubusercontent.com/assets/314716/15148648/26fd7162-16be-11e6-84b9-347e388d99f2.png)"},"comment":{"url":"https://api.github.com/repos/matplotlib/matplotlib/issues/comments/218660349","html_url":"https://github.com/matplotlib/matplotlib/issues/6394#issuecomment-218660349","issue_url":"https://api.github.com/repos/matplotlib/matplotlib/issues/6394","id":218660349,"user":{"login":"tacaswell","id":199813,"avatar_url":"https://avatars.githubusercontent.com/u/199813?v=3","gravatar_id":"","url":"https://api.github.com/users/tacaswell","html_url":"https://github.com/tacaswell","followers_url":"https://api.github.com/users/tacaswell/followers","following_url":"https://api.github.com/users/tacaswell/following{/other_user}","gists_url":"https://api.github.com/users/tacaswell/gists{/gist_id}","starred_url":"https://api.github.com/users/tacaswell/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tacaswell/subscriptions","organizations_url":"https://api.github.com/users/tacaswell/orgs","repos_url":"https://api.github.com/users/tacaswell/repos","events_url":"https://api.github.com/users/tacaswell/events{/privacy}","received_events_url":"https://api.github.com/users/tacaswell/received_events","type":"User","site_admin":false},"created_at":"2016-05-12T04:56:44Z","updated_at":"2016-05-12T04:56:44Z","body":"It is something funny with the `'>f8'` type.  If you do anything to change the data type of the input (multiply by `1`, `hdu.data.astype('float')`, `hdu.data.byteswap().newbyteorder()`) fixes the plot.\r\n\r\n@mdboom I think the problem is in here https://github.com/matplotlib/matplotlib/blob/master/src/_image_wrapper.cpp#L280 which does not do anything special about non-native byte order.  I am not sure of the right place to fix this (c++ layer or where we intake the data)."}}