Title: Axes.imshow draws invalid color at value is 0 when max of 'X' not equal to vmax · Issue #16910 · matplotlib/matplotlib · GitHub
Open Graph Title: Axes.imshow draws invalid color at value is 0 when max of 'X' not equal to vmax · Issue #16910 · matplotlib/matplotlib
X Title: Axes.imshow draws invalid color at value is 0 when max of 'X' not equal to vmax · Issue #16910 · matplotlib/matplotlib
Description: Bug report Bug summary Axes.imshow draws invalid color at cells which value is 0 when max value of parameter 'X' is not equal to parameter 'vmax' Code for reproduction import matplotlib.pyplot as plt import matplotlib.ticker as ticker im...
Open Graph Description: Bug report Bug summary Axes.imshow draws invalid color at cells which value is 0 when max value of parameter 'X' is not equal to parameter 'vmax' Code for reproduction import matplotlib.pyplot as p...
X Description: Bug report Bug summary Axes.imshow draws invalid color at cells which value is 0 when max value of parameter 'X' is not equal to parameter 'vmax' Code for reproduction import matplo...
Opengraph URL: https://github.com/matplotlib/matplotlib/issues/16910
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Axes.imshow draws invalid color at value is 0 when max of 'X' not equal to vmax","articleBody":"\u003c!--To help us understand and resolve your issue, please fill out the form to the best of your ability.--\u003e\r\n\u003c!--You can feel free to delete the sections that do not apply.--\u003e\r\n\r\n### Bug report\r\n\r\n**Bug summary**\r\n\r\nAxes.imshow draws invalid color at cells which value is 0 when max value of parameter 'X' is not equal to parameter 'vmax'\r\n\r\n**Code for reproduction**\r\n\r\n\u003c!--A minimum code snippet required to reproduce the bug.\r\nPlease make sure to minimize the number of dependencies required, and provide\r\nany necessary plotted data.\r\nAvoid using threads, as Matplotlib is (explicitly) not thread-safe.--\u003e\r\n\r\n```python\r\nimport matplotlib.pyplot as plt\r\nimport matplotlib.ticker as ticker\r\nimport numpy as np\r\n\r\ncmap = plt.cm.get_cmap('autumn_r')\r\ncmap.set_under(color='lightgrey')\r\n\r\nfig = plt.figure()\r\nax = fig.add_subplot()\r\nax.grid(which='major', color='white', linestyle='dotted', alpha=0.7)\r\nax.grid(which='minor', color='white', linestyle='dotted', alpha=0.5)\r\n\r\ndata = np.array([[-1, -1, -1, 0, 0, 0, 0, 43, 79, 95, 66, 1, -1, -1, -1, 0, 0, 0, 34]])\r\n# data = np.array([[-1, -1, -1, 0, 0, 0, 0, 43, 79, 100, 66, 1, -1, -1, -1, 0, 0, 0, 34]])\r\nim = ax.imshow(data, aspect='auto', cmap=cmap, vmin=0, vmax=100)\r\nax.xaxis.set_major_locator(ticker.MultipleLocator())\r\nax.set_yticks([0])\r\nfig.colorbar(im)\r\n\r\nplt.show()\r\n```\r\n\r\n**Actual outcome**\r\n\r\nI expect yellow at cells 3, 4, 5, 6, 15, 16, 17. but they are grey.\r\n\r\n\r\n\r\n**Expected outcome**\r\n\r\nif using commented data(max(data) == vmax), got output below. that is valid.\r\n\r\n\r\n\r\n\u003c!--A description of the expected outcome from the code snippet--\u003e\r\n\u003c!--If this used to work in an earlier version of Matplotlib, please note the version it used to work on--\u003e\r\n\r\n**Matplotlib version**\r\n\u003c!--Please specify your platform and versions of the relevant libraries you are using:--\u003e\r\n * Operating system: Windows10\r\n * Matplotlib version: 3.1.3\r\n * Matplotlib backend (`print(matplotlib.get_backend())`): TkAgg\r\n * Python version: 3.7.4\r\n\r\n\u003c!--Please tell us how you installed matplotlib and python e.g., from source, pip, conda--\u003e\r\n\u003c!--If you installed from conda, please specify which channel you used if not the default--\u003e\r\n\r\n","author":{"url":"https://github.com/fifzteen","@type":"Person","name":"fifzteen"},"datePublished":"2020-03-26T06:27:36.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":30},"url":"https://github.com/16910/matplotlib/issues/16910"}
| 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:7c49b84a-3c00-b38a-93d6-025e5809d5bd |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | DAD8:171DD4:F33110:1453978:6A529199 |
| html-safe-nonce | bb5636f2128d4369b68aa194ce15ae82595b61d048c3736cd5bc170315293b0f |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEQUQ4OjE3MURENDpGMzMxMTA6MTQ1Mzk3ODo2QTUyOTE5OSIsInZpc2l0b3JfaWQiOiI0NDA0NDUxNjEwNTAxMjIyODEwIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 86eb0967178838065e1fd350cf3bcb1eee8968a4916b752dfb4b42901603b6e9 |
| hovercard-subject-tag | issue:588186842 |
| 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/16910/issue_layout |
| twitter:image | https://opengraph.githubassets.com/6e186da3d14bdf3f43bf6ca00628241d85e0a2d91a94eda1bdc13e6eb2d0048e/matplotlib/matplotlib/issues/16910 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/6e186da3d14bdf3f43bf6ca00628241d85e0a2d91a94eda1bdc13e6eb2d0048e/matplotlib/matplotlib/issues/16910 |
| og:image:alt | Bug report Bug summary Axes.imshow draws invalid color at cells which value is 0 when max value of parameter 'X' is not equal to parameter 'vmax' Code for reproduction import matplotlib.pyplot as p... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | fifzteen |
| 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