Title: [MNT]: mplot3d azim-elev-roll order · Issue #28353 · matplotlib/matplotlib · GitHub
Open Graph Title: [MNT]: mplot3d azim-elev-roll order · Issue #28353 · matplotlib/matplotlib
X Title: [MNT]: mplot3d azim-elev-roll order · Issue #28353 · matplotlib/matplotlib
Description: Summary Part of PR #21426 'Add ability to roll the camera in 3D plots' (by Scott Shambaugh, 3 years ago) read as follows: - Make elev, azim, roll ordering consistent everywhere However, the choice of ordering is rather unfortunate: It is...
Open Graph Description: Summary Part of PR #21426 'Add ability to roll the camera in 3D plots' (by Scott Shambaugh, 3 years ago) read as follows: - Make elev, azim, roll ordering consistent everywhere However, the choice ...
X Description: Summary Part of PR #21426 'Add ability to roll the camera in 3D plots' (by Scott Shambaugh, 3 years ago) read as follows: - Make elev, azim, roll ordering consistent everywhere However, the...
Opengraph URL: https://github.com/matplotlib/matplotlib/issues/28353
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"[MNT]: mplot3d azim-elev-roll order","articleBody":"### Summary\n\nPart of PR #21426 'Add ability to roll the camera in 3D plots' (by Scott Shambaugh, 3 years ago) read as follows:\r\n`- Make elev, azim, roll ordering consistent everywhere`\r\n\r\nHowever, the choice of ordering is rather unfortunate:\r\n- It is not the common one (most everyone else in the world uses azim-elev-roll, see below)\r\n- It does not correspond to the order in which the 3 rotations take place (that's azim-elev-roll)\r\n- It is not consistent with the ordering in matplotlib's `colors.py`.\r\n\r\nI.e., there is room for improvement.\r\n\r\n-----\r\n When I google:\r\n- `\"azimuth, elevation\"` -\u003e 291 000 results\r\n- `\"elevation, azimuth\"`-\u003e 41 500 results\r\n\r\nThat is to say, the `elevation, azimuth` ordering is not the common one. And if we consider that searching _for both_ yields:\r\n- `\"azimuth, elevation\" and \"elevation, azimuth\"` -\u003e 37 500 results (some links are non-committal), \r\n\r\nthen it becomes clear that the `elevation, azimuth` ordering is really a minority position: (41-37)/(291-37) \u003c 2%.\r\n(Also, for what it's worth: MATLAB happens to use `\"azimuth, elevation\"`, just like (almost) everyone else.)\r\n\r\n-----\r\nThe ordering with elevation first does not correspond to the order in which the 3 rotations take place:\r\nif thinking about intrinsic rotations, then the rotation order is azim, elev, then roll.\r\nThe corresponding quaternion is\r\n` q = exp((+roll/2)*e_x)*exp((+elev/2)*e_y)*exp((-azim/2)*e_z)`\r\ni.e., to be precise, mplot3d's `azim, elev, roll` are a kind of Tait-Bryan angles, -z,y',x\".\r\nIt is a bit of a mess with the Euler angles, apparently there are 24 variations (not counting the signs) - https://github.com/moble/quaternion/wiki/Euler-angles-are-horrible\r\n\r\n\n\n### Proposed fix\n\nSwitch (back) to the common ordering, the order in which the rotations are performed: `azim, elev, roll`.\r\n\r\nFortunately, Scott had the good foresight to use named parameters, so it is not a completely breaking change.\r\nWe can make the use of named parameters for `azim` and `elev` mandatory (preceding with a '*' argument), so changing the order (when parameters are unnamed) won't result in any silent failures.\r\n\r\nScott voiced a hesitation to change it (again), and I can understand his initial reaction. However, it seems to me that changing the order has clear benefits, and arguably it could be worth the effort of adapting existing code, as per https://matplotlib.org/devdocs/devel/api_changes.html (especially in view of the fact that the effort might be limited, with the named parameters).\r\n\r\nI have a PR almost ready to show what the changes would be.","author":{"url":"https://github.com/MischaMegens2","@type":"Person","name":"MischaMegens2"},"datePublished":"2024-06-06T05:38:42.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":11},"url":"https://github.com/28353/matplotlib/issues/28353"}
| 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:d180a5cc-bde9-91b7-4dc0-a11669023cae |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 9C9E:2D0224:EBB998:13F7EF3:6A51FC19 |
| html-safe-nonce | 61e80b495998fd8ddb823dea565ec74b6b6cfb4fac82d7d346a1eb268c3a7f84 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5QzlFOjJEMDIyNDpFQkI5OTg6MTNGN0VGMzo2QTUxRkMxOSIsInZpc2l0b3JfaWQiOiIzMjkzMjYyNDA5MDI4OTkyMDI1IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 482b48a6432afb9a4fd70ea2ca08e93a81227e8f006838de4781f73aaa003952 |
| hovercard-subject-tag | issue:2337352667 |
| 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/28353/issue_layout |
| twitter:image | https://opengraph.githubassets.com/8e21e49ab0223ff0a5af122ba1ba742a27708f0efdacf8fe38bf474ae8da2c72/matplotlib/matplotlib/issues/28353 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/8e21e49ab0223ff0a5af122ba1ba742a27708f0efdacf8fe38bf474ae8da2c72/matplotlib/matplotlib/issues/28353 |
| og:image:alt | Summary Part of PR #21426 'Add ability to roll the camera in 3D plots' (by Scott Shambaugh, 3 years ago) read as follows: - Make elev, azim, roll ordering consistent everywhere However, the choice ... |
| 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 | 7aed05249554b889eb33d002851a973eebcc7e91 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width