Title: Fix NoNorm cursor formatting for uint8 images by goutamadwant · Pull Request #31967 · matplotlib/matplotlib · GitHub
Open Graph Title: Fix NoNorm cursor formatting for uint8 images by goutamadwant · Pull Request #31967 · matplotlib/matplotlib
X Title: Fix NoNorm cursor formatting for uint8 images by goutamadwant · Pull Request #31967 · matplotlib/matplotlib
Description: PR summary closes #31960 This fixes cursor formatting for uint8 image data displayed with colors.NoNorm(). NoNorm returns the original NumPy scalar value. With recent NumPy versions, multiplying a uint8 cursor value by the colormap size can raise OverflowError while Matplotlib computes neighboring color intervals for cursor display precision. This change converts the normalized scalar to a Python scalar at the point where that interval arithmetic is needed, preserving the existing cursor readout behavior while avoiding the narrow-dtype overflow. Before this change, formatting a uint8 cursor value from a NoNorm image raised OverflowError. After this change, it returns the expected cursor label. Breaking changes: None. Tests run: python -P -m pytest lib/matplotlib/tests/test_image.py::test_format_cursor_data_uint8_no_norm lib/matplotlib/tests/test_image.py::test_format_cursor_data python -P -m pytest lib/matplotlib/tests/test_image.py::test_format_cursor_data_multinorm lib/matplotlib/tests/test_artist.py::test_format_cursor_data_BoundaryNorm python -P -m pytest lib/matplotlib/tests/test_image.py -k cursor_data AI Disclosure I used Codex to review the relevant code and understand the existing codebase. PR checklist "closes #31960" is in the body of the PR description to link the related issue new and changed code is tested [N/A] Plotting related features are demonstrated in an example [N/A] New Features and API Changes are noted with a directive and release note [N/A] Documentation complies with general and docstring guidelines
Open Graph Description: PR summary closes #31960 This fixes cursor formatting for uint8 image data displayed with colors.NoNorm(). NoNorm returns the original NumPy scalar value. With recent NumPy versions, multiplying a ...
X Description: PR summary closes #31960 This fixes cursor formatting for uint8 image data displayed with colors.NoNorm(). NoNorm returns the original NumPy scalar value. With recent NumPy versions, multiplying a ...
Opengraph URL: https://github.com/matplotlib/matplotlib/pull/31967
X: @github
Domain: github.com
| route-pattern | /:user_id/:repository/pull/:id/files(.:format) |
| route-controller | pull_requests |
| route-action | files |
| fetch-nonce | v2:9d87a2ef-9f05-cf26-f14c-febb6386f74d |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | EC28:14011B:6295E0E:8A84109:6A50256A |
| html-safe-nonce | 8f24e07c6cdc379095bcf0ac14723deaf6ebcec5a95636f12874637fa0a691c0 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFQzI4OjE0MDExQjo2Mjk1RTBFOjhBODQxMDk6NkE1MDI1NkEiLCJ2aXNpdG9yX2lkIjoiNTM1OTU1MDgzNDE2OTM1NzY3NCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 2f350abc498f981a3ee3bedb7030025ac4842ecd3b0ae911bd415538b83a15f3 |
| hovercard-subject-tag | pull_request:3951635586 |
| github-keyboard-shortcuts | repository,pull-request-list,pull-request-conversation,pull-request-files-changed,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/matplotlib/matplotlib/pull/31967/files |
| twitter:image | https://avatars.githubusercontent.com/u/8672451?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/8672451?s=400&v=4 |
| og:image:alt | PR summary closes #31960 This fixes cursor formatting for uint8 image data displayed with colors.NoNorm(). NoNorm returns the original NumPy scalar value. With recent NumPy versions, multiplying a ... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | a08040246389072795e3b4e7b33c6d9a0c564eee02e829a809326d67c418b069 |
| turbo-cache-control | no-preview |
| diff-view | unified |
| 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 full-width |
| disable-turbo | true |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | d1b91b18e7330fc458dfd824c61eaed7daa830d6 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width