Title: [Bug]: imshow uint8 image with colors.NoNorm() causes OverflowError when mousing over figure · Issue #31960 · matplotlib/matplotlib · GitHub
Open Graph Title: [Bug]: imshow uint8 image with colors.NoNorm() causes OverflowError when mousing over figure · Issue #31960 · matplotlib/matplotlib
X Title: [Bug]: imshow uint8 image with colors.NoNorm() causes OverflowError when mousing over figure · Issue #31960 · matplotlib/matplotlib
Description: Bug summary I'm displaying a uint8 image, intending to show the actual values in the image (i.e. no min-max scaling as is the default). Specifying colors.NoNorm() as the norm argument is I think the recommended way to do this. The image ...
Open Graph Description: Bug summary I'm displaying a uint8 image, intending to show the actual values in the image (i.e. no min-max scaling as is the default). Specifying colors.NoNorm() as the norm argument is I think th...
X Description: Bug summary I'm displaying a uint8 image, intending to show the actual values in the image (i.e. no min-max scaling as is the default). Specifying colors.NoNorm() as the norm argument is I thin...
Opengraph URL: https://github.com/matplotlib/matplotlib/issues/31960
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"[Bug]: imshow uint8 image with colors.NoNorm() causes OverflowError when mousing over figure","articleBody":"### Bug summary\n\nI'm displaying a uint8 image, intending to show the actual values in the image (i.e. no min-max scaling as is the default). Specifying `colors.NoNorm()` as the `norm` argument is I think the recommended way to do this. The image is shown correctly. But when mousing over the image the terminal window is filled with:\n```none\nTraceback (most recent call last):\n File \"/opt/homebrew/lib/python3.14/site-packages/matplotlib/cbook.py\", line 361, in process\n func(*args, **kwargs)\n ~~~~^^^^^^^^^^^^^^^^^\n File \"/opt/homebrew/lib/python3.14/site-packages/matplotlib/backend_bases.py\", line 2956, in mouse_move\n self.set_message(self._mouse_event_to_message(event))\n ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^\n File \"/opt/homebrew/lib/python3.14/site-packages/matplotlib/backend_bases.py\", line 2948, in _mouse_event_to_message\n data_str = a.format_cursor_data(data).rstrip()\n ~~~~~~~~~~~~~~~~~~~~^^^^^^\n File \"/opt/homebrew/lib/python3.14/site-packages/matplotlib/artist.py\", line 1354, in format_cursor_data\n return self._format_cursor_data_override(data)\n ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^\n File \"/opt/homebrew/lib/python3.14/site-packages/matplotlib/colorizer.py\", line 498, in _format_cursor_data_override\n (int(normed * n) + np.array([0, 1])) / n)\n ~~~~~~~^~~\nOverflowError: Python integer 256 out of bounds for uint8\n```\nI am assuming this is caused by the code that writes pixel values in the bottom-right corner of the figure window.\n\n### Code for reproduction\n\n```Python\nimport matplotlib\nimport matplotlib.pyplot as plt\nimport numpy as np\n\nimg = np.tile(np.arange(100, dtype=np.uint8), (100, 1))\nplt.imshow(img, norm=matplotlib.colors.NoNorm())\nplt.show()\n```\n\n### Actual outcome\n\nThe terminal is filled with repeated OverflowError messages as shown above.\n\n### Expected outcome\n\nNo error messages.\n\n### Additional information\n\nThis did not happen when I originally wrote my code 9 years ago. I can't be sure, but I think this is a fairly recent regression.\n\n### Operating system\n\nmacOS\n\n### Matplotlib Version\n\n3.10.9 and 3.11.0\n\n### Matplotlib Backend\n\nmacosx\n\n### Python version\n\n3.14.5\n\n### Jupyter version\n\n_No response_\n\n### Installation\n\npip","author":{"url":"https://github.com/crisluengo","@type":"Person","name":"crisluengo"},"datePublished":"2026-06-27T12:02:28.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":2},"url":"https://github.com/31960/matplotlib/issues/31960"}
| 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:b977b1a6-b7a7-ebcc-b41f-5659bfd37c04 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 8696:1ED8:4A96E98:69C47A1:6A4FE4B8 |
| html-safe-nonce | 1a9887dcbb5d88dc8cbc36dec7fc964bfa60595a0783a8c12d3d2296aca1f1da |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4Njk2OjFFRDg6NEE5NkU5ODo2OUM0N0ExOjZBNEZFNEI4IiwidmlzaXRvcl9pZCI6IjM5MDg0ODMxNTgxMTk1Mzk4OTYiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 3f95518177ce0a86b10fede28b8559f7fb1b7d0da4b688d006c03b16467650d2 |
| hovercard-subject-tag | issue:4758221651 |
| 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/31960/issue_layout |
| twitter:image | https://opengraph.githubassets.com/a1d630f0f43845a65a2ae6b67dfce00018575e7486384ff7cc8e06cad90e9144/matplotlib/matplotlib/issues/31960 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/a1d630f0f43845a65a2ae6b67dfce00018575e7486384ff7cc8e06cad90e9144/matplotlib/matplotlib/issues/31960 |
| og:image:alt | Bug summary I'm displaying a uint8 image, intending to show the actual values in the image (i.e. no min-max scaling as is the default). Specifying colors.NoNorm() as the norm argument is I think th... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | crisluengo |
| hostname | github.com |
| expected-hostname | github.com |
| None | 19b98c3d9767bb8a56238a89ff8401d1cbdf3bc5c353799aacf49fe6c76b4b7c |
| 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 | 142593e66413bbae27fd485859993597d5a3b104 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width