Title: DPI-connected bug of imshow when using multiple masked arrays · Issue #3057 · matplotlib/matplotlib · GitHub
Open Graph Title: DPI-connected bug of imshow when using multiple masked arrays · Issue #3057 · matplotlib/matplotlib
X Title: DPI-connected bug of imshow when using multiple masked arrays · Issue #3057 · matplotlib/matplotlib
Description: Initial discussion started here: http://stackoverflow.com/questions/23490289/matplotlib-shows-different-figure-than-saves-from-the-show-window Essentially I need to combine a few arrays to make a whole image I want to produce using imsho...
Open Graph Description: Initial discussion started here: http://stackoverflow.com/questions/23490289/matplotlib-shows-different-figure-than-saves-from-the-show-window Essentially I need to combine a few arrays to make a w...
X Description: Initial discussion started here: http://stackoverflow.com/questions/23490289/matplotlib-shows-different-figure-than-saves-from-the-show-window Essentially I need to combine a few arrays to make a w...
Opengraph URL: https://github.com/matplotlib/matplotlib/issues/3057
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"DPI-connected bug of imshow when using multiple masked arrays","articleBody":"Initial discussion started here: http://stackoverflow.com/questions/23490289/matplotlib-shows-different-figure-than-saves-from-the-show-window\n\nEssentially I need to combine a few arrays to make a whole image I want to produce using imshow. So that the arrays do not overlay each other I use masking (as in the example at StackOverflow) or I set some data to `None`, so that it is not plotted; I do this:\n\n```\ncmap = matplotlib.cm.get_cmap()\ncmap.set_bad('w', 0.0)\n```\n\nSee the whole working example:\n\n```\nimport matplotlib\nimport matplotlib.pyplot as plt\nimport numpy as np\n\ndata = np.random.random((3000, 3000))\ndata[np.tril_indices_from(data, 1)] = None\ndata2 = np.random.random((3000, 3000))\ndata2[np.triu_indices_from(data2, -1)] = None\n\ncmap = matplotlib.cm.get_cmap()\ncmap.set_bad('w', 0.0)\n\nplt.imshow(data, interpolation='none', cmap=cmap)\nplt.imshow(data2, interpolation='none', cmap=cmap)\nplt.locator_params(nbins=60)\nplt.show()\n```\n\nSo the thing is, if I look at such image in an interactive window everything looks perfect (e.g. I zoomed into top-left corner, so that the pixels are visible:\n\n\nIf I save the whole image to a file from the Save-dialog of the window, the image gets screwed, so that the pixels are much bigger, than they should (it is a printscreen of Inkscape with opened SVG-file, where I zoomed to approximately the same coordinates):\n\nSame goes to direct saving the image to disk (SVG):\n\nIf I use only data, but not data2, the image looks good:\n\nIf I save both of them, but change the dpi (e.g. to 900), the image changes and the so-to-say resolution gets better, but the image gets really messy:\n\nYou can probably see, that some pixels are distorted. If not, here is a closer zoom into this image:\n\nAt the same time you can see, that the white diagonal no more ends and starts in the very corner of the image.\n\nAs far as I understand, this is a bug, or at least undocumented behaviour, because I haven't found any mentioning of possibility of such weird effects anywhere. Using such plots (though not randomly generated) is crucial to my research, I would really like this fixed or being pointed out to a solution for this problem.\n\nPlease let me know, if you can reproduce such effects and if you need any further information from me.\n\nI use matplotlib 1.3.1 on Ubuntu 14.04 with Python 2.7.6 and Spyder 2.2.5.\n","author":{"url":"https://github.com/Phlya","@type":"Person","name":"Phlya"},"datePublished":"2014-05-10T19:40:21.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":15},"url":"https://github.com/3057/matplotlib/issues/3057"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:0aab0281-ea2d-abe3-cbec-3df209bf1484 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | D36C:3E013F:1FCEBE:299F5F:6A52E5B1 |
| html-safe-nonce | c6db59ba2ac1260fe65237cfef235d6e269b6b2f5b18659b2089011ea3d06647 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEMzZDOjNFMDEzRjoxRkNFQkU6Mjk5RjVGOjZBNTJFNUIxIiwidmlzaXRvcl9pZCI6IjY1MDg3NjExNzc3OTQ5OTU2MzMiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | db62671851a0ff0a254f0c7d8e0c5c69acf3e78f592e7f1563377a38868de1c7 |
| hovercard-subject-tag | issue:33246844 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/matplotlib/matplotlib/3057/issue_layout |
| twitter:image | https://opengraph.githubassets.com/d0f9ed9cba8f66da9ec43ce5a9c3e3524aa1f293c8e300cc36cd0dac62754942/matplotlib/matplotlib/issues/3057 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/d0f9ed9cba8f66da9ec43ce5a9c3e3524aa1f293c8e300cc36cd0dac62754942/matplotlib/matplotlib/issues/3057 |
| og:image:alt | Initial discussion started here: http://stackoverflow.com/questions/23490289/matplotlib-shows-different-figure-than-saves-from-the-show-window Essentially I need to combine a few arrays to make a w... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | Phlya |
| hostname | github.com |
| expected-hostname | github.com |
| None | b9a586c06a05a7a86fc7e3f4dbd03e42f6869085879aa184aa6369456dbd50fb |
| turbo-cache-control | no-preview |
| go-import | github.com/matplotlib/matplotlib git https://github.com/matplotlib/matplotlib.git |
| octolytics-dimension-user_id | 215947 |
| octolytics-dimension-user_login | matplotlib |
| octolytics-dimension-repository_id | 1385122 |
| octolytics-dimension-repository_nwo | matplotlib/matplotlib |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 1385122 |
| octolytics-dimension-repository_network_root_nwo | matplotlib/matplotlib |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 07a982c1d40157c619b364352b704c3ce66bb332 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width