Title: [Bug]: axes3d.py's _on_move() converts the roll angle to radians, but then passes it to view_init() as if it were still in degrees · Issue #28256 · matplotlib/matplotlib · GitHub
Open Graph Title: [Bug]: axes3d.py's _on_move() converts the roll angle to radians, but then passes it to view_init() as if it were still in degrees · Issue #28256 · matplotlib/matplotlib
X Title: [Bug]: axes3d.py's _on_move() converts the roll angle to radians, but then passes it to view_init() as if it were still in degrees · Issue #28256 · matplotlib/matplotlib
Description: Bug summary In \lib\mpl_toolkits\mplot3d\axes3d.py, _on_move() deals with rotation of 3d axes using the mouse. In line 1522, the roll angle (in degrees) is converted to radians: roll = np.deg2rad(self.roll) This roll in radians is used t...
Open Graph Description: Bug summary In \lib\mpl_toolkits\mplot3d\axes3d.py, _on_move() deals with rotation of 3d axes using the mouse. In line 1522, the roll angle (in degrees) is converted to radians: roll = np.deg2rad(s...
X Description: Bug summary In \lib\mpl_toolkits\mplot3d\axes3d.py, _on_move() deals with rotation of 3d axes using the mouse. In line 1522, the roll angle (in degrees) is converted to radians: roll = np.deg2rad(s...
Opengraph URL: https://github.com/matplotlib/matplotlib/issues/28256
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"[Bug]: axes3d.py's _on_move() converts the roll angle to radians, but then passes it to view_init() as if it were still in degrees","articleBody":"### Bug summary\n\nIn \\lib\\mpl_toolkits\\mplot3d\\axes3d.py, `_on_move()` deals with rotation of 3d axes using the mouse. In line 1522, the roll angle (in degrees) is converted to radians:\r\n` roll = np.deg2rad(self.roll)`\r\nThis roll in radians is used to calculate a new elevation and azimuth, like so:\r\n```\r\n delev = -(dy/h)*180*np.cos(roll) + (dx/w)*180*np.sin(roll)\r\n dazim = -(dy/h)*180*np.sin(roll) - (dx/w)*180*np.cos(roll)\r\n elev = self.elev + delev\r\n azim = self.azim + dazim\r\n```\r\nA moment later, the view is updated:\r\n```\r\n self.view_init(\r\n elev=elev,\r\n azim=azim,\r\n roll=roll,\r\n vertical_axis=vertical_axis,\r\n share=True,\r\n )\r\n```\r\nHowever, `view_init()` expects its parameters to be in degrees, not radians. As a consequence, the roll now diminishes by a factor pi/180 with every mouse movement. Not intended.\r\n\n\n### Code for reproduction\n\n```Python\n# Run the surface3d.py example, adding\r\nax.roll = 45\r\n# It shows the plot, in the intended funny orientation (roll=45)\r\n# Then move the mouse - you will see the orientation jump suddenly (to roll=0)\n```\n\n\n### Actual outcome\n\nThe figure orientation has jumped to roll=0, after trying to rotate it only slightly by dragging the mouse:\r\n\r\n\n\n### Expected outcome\n\nThe figure is close to its original orientation (before dragging the mouse), at roll=45:\r\n\r\n\n\n### Additional information\n\nFix: add a line:\r\n`roll = self.roll`\r\nright after updating `elev` and `azim` (i.e., after line 1526).\r\n\n\n### Operating system\n\nAll, presumably; but I noticed it on Windows\n\n### Matplotlib Version\n\n3.10.0.dev191+ge5af947d1b.d20240517\n\n### Matplotlib Backend\n\ntkagg\n\n### Python version\n\nPython 3.12.3\n\n### Jupyter version\n\n_No response_\n\n### Installation\n\npip","author":{"url":"https://github.com/MischaMegens2","@type":"Person","name":"MischaMegens2"},"datePublished":"2024-05-17T22:45:44.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":0},"url":"https://github.com/28256/matplotlib/issues/28256"}
| 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:e7046157-7c31-fabb-8360-734cf0b0a155 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | C00A:260009:7C8F91:A86C78:6A52713B |
| html-safe-nonce | 4a8ddee9b7c2d3a513be527b8e6a5e7ff63829b843b7c6aab3879007b399258b |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDMDBBOjI2MDAwOTo3QzhGOTE6QTg2Qzc4OjZBNTI3MTNCIiwidmlzaXRvcl9pZCI6IjgxNDQzMzg1MjI4NzIxMTU1MTUiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 305b82e06bbf7e94e98e1ba244ca36dcc160e810e907908b29753caeaf1e9f99 |
| hovercard-subject-tag | issue:2303659932 |
| 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/28256/issue_layout |
| twitter:image | https://opengraph.githubassets.com/88f49ea10f12c91ca3de4fd58dd299d8c3cb4f87a8fdf72f0b3ec94afc028825/matplotlib/matplotlib/issues/28256 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/88f49ea10f12c91ca3de4fd58dd299d8c3cb4f87a8fdf72f0b3ec94afc028825/matplotlib/matplotlib/issues/28256 |
| og:image:alt | Bug summary In \lib\mpl_toolkits\mplot3d\axes3d.py, _on_move() deals with rotation of 3d axes using the mouse. In line 1522, the roll angle (in degrees) is converted to radians: roll = np.deg2rad(s... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | MischaMegens2 |
| 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 | canary-2 |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width