Title: Colorbar for imshow messes interactive cursor with masked data · Issue #15103 · matplotlib/matplotlib · GitHub
Open Graph Title: Colorbar for imshow messes interactive cursor with masked data · Issue #15103 · matplotlib/matplotlib
X Title: Colorbar for imshow messes interactive cursor with masked data · Issue #15103 · matplotlib/matplotlib
Description: Bug report Adding a colorbar when the mappable is the result of imshow for a masked array changes the behavior of the interactive z-data cursor and triggers a UserWarning. Code for reproduction import numpy as np import matplotlib.pyplot...
Open Graph Description: Bug report Adding a colorbar when the mappable is the result of imshow for a masked array changes the behavior of the interactive z-data cursor and triggers a UserWarning. Code for reproduction imp...
X Description: Bug report Adding a colorbar when the mappable is the result of imshow for a masked array changes the behavior of the interactive z-data cursor and triggers a UserWarning. Code for reproduction imp...
Opengraph URL: https://github.com/matplotlib/matplotlib/issues/15103
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Colorbar for imshow messes interactive cursor with masked data","articleBody":"### Bug report\r\n\r\nAdding a colorbar when the mappable is the result of imshow for a masked array changes the behavior of the interactive z-data cursor and triggers a UserWarning.\r\n\r\n**Code for reproduction**\r\n```python\r\nimport numpy as np\r\nimport matplotlib.pyplot as plt\r\n\r\nmask = np.zeros((4, 4), bool)\r\nmask[:2] = True\r\nA = np.ma.array(np.random.rand(4, 4), mask=mask)\r\n\r\nfig, ax = plt.subplots(1, 1)\r\nim = ax.imshow(A)\r\nfig.colorbar(im)\r\n```\r\n\r\n**Actual outcome**\r\n```\r\n~/.anaconda3/lib/python3.7/site-packages/matplotlib/ticker.py:632: UserWarning: Warning: converting a masked element to nan.\r\n return '%-12g' % value\r\n```\r\n\r\n\r\n**Expected outcome**\r\nBefore adding the colorbar, the zdata cursor shows a blank (`[]`).\r\n\r\n**Matplotlib version**\r\n * Operating system: Linux\r\n * Matplotlib version: 3.1.1\r\n * Matplotlib backend (`print(matplotlib.get_backend())`): Qt5Agg\r\n * Python version: 3.7.3\r\n * IPython version: 7.2.0\r\n * Other libraries: \r\nMatplotlib installed from pip.\r\n\r\n\r\n\r\n","author":{"url":"https://github.com/Descanonge","@type":"Person","name":"Descanonge"},"datePublished":"2019-08-22T16:25:05.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":3},"url":"https://github.com/15103/matplotlib/issues/15103"}
| 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:53472e22-ebb4-b3d3-a0ca-3752887b30d6 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | A586:126BF:37C77A:394C3C:6A519A5E |
| html-safe-nonce | cc23056f13be34dd6fd35913f6bcde411408e92872b00e0c3fdd1daee176da50 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBNTg2OjEyNkJGOjM3Qzc3QTozOTRDM0M6NkE1MTlBNUUiLCJ2aXNpdG9yX2lkIjoiNDk3NTE4NzA4OTc5NDYzNjM4MiIsInJlZ2lvbl9lZGdlIjoic2VhIiwicmVnaW9uX3JlbmRlciI6InNlYSJ9 |
| visitor-hmac | 3d970d54a0ddda9c252aaf6b62cfef9e4e81edb11becb617e15458bc8719a38b |
| hovercard-subject-tag | issue:484094635 |
| 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/15103/issue_layout |
| twitter:image | https://opengraph.githubassets.com/6fb6cfc7af966dc979998e20c13173f1f74c5498758220228cd561a565415f10/matplotlib/matplotlib/issues/15103 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/6fb6cfc7af966dc979998e20c13173f1f74c5498758220228cd561a565415f10/matplotlib/matplotlib/issues/15103 |
| og:image:alt | Bug report Adding a colorbar when the mappable is the result of imshow for a masked array changes the behavior of the interactive z-data cursor and triggers a UserWarning. Code for reproduction imp... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | Descanonge |
| 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 | 7aed05249554b889eb33d002851a973eebcc7e91 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width