Title: [Bug]: Logscale Axis + NonUniformImage + GUI move tool = Distortion · Issue #27820 · matplotlib/matplotlib · GitHub
Open Graph Title: [Bug]: Logscale Axis + NonUniformImage + GUI move tool = Distortion · Issue #27820 · matplotlib/matplotlib
X Title: [Bug]: Logscale Axis + NonUniformImage + GUI move tool = Distortion · Issue #27820 · matplotlib/matplotlib
Description: Bug summary Run the code below, which uses set.xscale("log") and NonUniformImage. Choose the move tool (Arrows in all 4 directions) and try to pan the image around. Instead of panning, image distorts. Code for reproduction import numpy a...
Open Graph Description: Bug summary Run the code below, which uses set.xscale("log") and NonUniformImage. Choose the move tool (Arrows in all 4 directions) and try to pan the image around. Instead of panning, image distor...
X Description: Bug summary Run the code below, which uses set.xscale("log") and NonUniformImage. Choose the move tool (Arrows in all 4 directions) and try to pan the image around. Instead of panning, im...
Opengraph URL: https://github.com/matplotlib/matplotlib/issues/27820
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"[Bug]: Logscale Axis + NonUniformImage + GUI move tool = Distortion","articleBody":"### Bug summary\n\nRun the code below, which uses set.xscale(\"log\") and NonUniformImage. Choose the move tool (Arrows in all 4 directions) and try to pan the image around. Instead of panning, image distorts.\n\n### Code for reproduction\n\n```Python\nimport numpy as np\r\nimport matplotlib.pyplot as plt\r\nfrom matplotlib.image import NonUniformImage\r\n\r\nchg=np.logspace(0,1,10)\r\nchg1=chg[:,None]\r\nchg2=chg[None,:]\r\ng=chg1+chg2\r\ng+=50*(np.add.outer(np.arange(10),np.arange(10))%2)\r\n#checkerboard, to make effect clearer\r\nfig,ax=plt.subplots()\r\nax.set_xscale(\"log\")\r\nax.set_yscale(\"log\")\r\nim=NonUniformImage(ax,extent=[chg[0],chg[-1],chg[0],chg[-1]],origin=\"lower\")\r\n\r\n\r\nim.set_data(np.linspace(1,10,10),np.linspace(1,10,10),g)\r\nax.add_image(im)\r\n\r\nplt.show()\n```\n\n\n### Actual outcome\n\n\r\n\r\n\r\nThese are supposed to be the same image. I just used the pan tool. \r\nBut the aspect ratio has changed. And the boundary of the rightmost colour change has gone from 0.75 to 0.5.\r\n\r\nClicking and dragging produces behaviour that is visually obviously not-right. \r\n\n\n### Expected outcome\n\nThe image should pan around. \n\n### Additional information\n\n No bug appears when I use a plt.imshow on the log scale axis. Or when I use the same NonUniformImage code without the logscale axis. The bug only appears with all 3 conditions are met.\r\n\r\nI was trying to find a sensible way to display an image on log-log axes with constant screen space per pixel, when I discovered this bug. \r\n\n\n### Operating system\n\nUbuntu\n\n### Matplotlib Version\n\n3.8.0\n\n### Matplotlib Backend\n\nQtAgg\n\n### Python version\n\nPython 3.11.5\n\n### Jupyter version\n\n_No response_\n\n### Installation\n\nconda","author":{"url":"https://github.com/DonaldHobson","@type":"Person","name":"DonaldHobson"},"datePublished":"2024-02-24T23:40:43.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":2},"url":"https://github.com/27820/matplotlib/issues/27820"}
| 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:4d2ce962-e7ca-9397-3608-847809b3e353 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 8832:2A3077:4E2B81:691E13:6A52D7ED |
| html-safe-nonce | dfcd5ac0851c03d069c6e7768326c673e557bdf42f26439a66e4e321f4462c8a |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4ODMyOjJBMzA3Nzo0RTJCODE6NjkxRTEzOjZBNTJEN0VEIiwidmlzaXRvcl9pZCI6IjM2Nzk1MjkwMDAwMDk2NTIyMDUiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 02ee2d8d3336e427d0a44aee81a66d5d048feed02ab09199266b1640166ae1bf |
| hovercard-subject-tag | issue:2152523170 |
| 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/27820/issue_layout |
| twitter:image | https://opengraph.githubassets.com/abb9b8ad47db12fc1d6179c8ad853ade0fd144d1dae2e80d901fb42b272a1262/matplotlib/matplotlib/issues/27820 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/abb9b8ad47db12fc1d6179c8ad853ade0fd144d1dae2e80d901fb42b272a1262/matplotlib/matplotlib/issues/27820 |
| og:image:alt | Bug summary Run the code below, which uses set.xscale("log") and NonUniformImage. Choose the move tool (Arrows in all 4 directions) and try to pan the image around. Instead of panning, image distor... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | DonaldHobson |
| 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