Title: [MNT]: Refactor autoscaling in 3D · Issue #28444 · matplotlib/matplotlib · GitHub
Open Graph Title: [MNT]: Refactor autoscaling in 3D · Issue #28444 · matplotlib/matplotlib
X Title: [MNT]: Refactor autoscaling in 3D · Issue #28444 · matplotlib/matplotlib
Description: Summary From #28403 (review): Current logic Extract all data coordinates xyz from the artist and feed them into auto_scale_xyz(). This updates the xy_dataLim, zz_dataLim BBoxes via .Bbox.update_from_data_xy/x/y(), which in turn creates a...
Open Graph Description: Summary From #28403 (review): Current logic Extract all data coordinates xyz from the artist and feed them into auto_scale_xyz(). This updates the xy_dataLim, zz_dataLim BBoxes via .Bbox.update_fro...
X Description: Summary From #28403 (review): Current logic Extract all data coordinates xyz from the artist and feed them into auto_scale_xyz(). This updates the xy_dataLim, zz_dataLim BBoxes via .Bbox.update_fro...
Opengraph URL: https://github.com/matplotlib/matplotlib/issues/28444
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"[MNT]: Refactor autoscaling in 3D","articleBody":"### Summary\n\nFrom https://github.com/matplotlib/matplotlib/pull/28403#pullrequestreview-2126623221:\r\n\r\n#### Current logic\r\n\r\n\u003e Extract all data coordinates *xyz* from the artist and feed them into `auto_scale_xyz()`.\r\n\r\nThis updates the `xy_dataLim`, `zz_dataLim` BBoxes via `.Bbox.update_from_data_xy/x/y()`, which in turn creates a `Path` and calls `.Bbox.update_from_path()`.\r\n\r\nThis is quite a lot data pushing (and maybe copying) just to update dataLim bboxes.\r\n\r\n#### Proposed logic\r\n\r\nSeparation of concerns: The Artists should have a function to get their data lims. These limits should be used to update the Bbox. Basically some `Bbox.update_from_box`, a kind of an in-place `Bbox.union`, which we don't seem to have.\r\n\r\nEssentially, we have should implement a 3D variant of Collection.get_datalim` for 3D.\n\n### Proposed fix\n\nRough outline: We may start minimal with rolling a small\r\n```\r\nclass _Bbox3d:\r\n def __init__(self, points):\r\n ((self.xmin, self.xmax),\r\n (self.ymin, self.ymax),\r\n (self.zmin, self.zmax)) = points\r\n\r\n def to_bbox_xy(self):\r\n return Bbox(((self.xmin, self.xmax), (self.ymin, self.ymax)))\r\n\r\n def to_bbox_zz(self):\r\n # first component contains z, second is unused\r\n return Bbox(((self.zmin, self.zmax), (0, 0)))\r\n```\r\nand implement `_get_datalim3d() -\u003e _Bbox3d` on the 3d collections.\r\n\r\nThen\r\n```\r\ndef add_collection(col, autolim=True):\r\n ...\r\n if autolim:\r\n self.auto_scale_lim(col.get_datalim3d())\r\n```\r\nand\r\n```\r\ndef auto_scale_lim(bbox3d):\r\n ...\r\n self.dataLim_xy.update_from_box(bbox3d.to_bbox_xy())\r\n self.dataLim_zz.update_from_box(bbox3d.to_bbox_zz())\r\n```\r\n","author":{"url":"https://github.com/timhoffm","@type":"Person","name":"timhoffm"},"datePublished":"2024-06-24T13:54:48.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":2},"url":"https://github.com/28444/matplotlib/issues/28444"}
| 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:2da52dfa-4c63-109f-866e-3f2634af782b |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | E342:1CCBDE:C88F1F:10E7F4A:6A53219B |
| html-safe-nonce | 87f3210ead3b9052c262448751bbd36971c29234113b4dd6eda21df6951d2c96 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFMzQyOjFDQ0JERTpDODhGMUY6MTBFN0Y0QTo2QTUzMjE5QiIsInZpc2l0b3JfaWQiOiI0MDE2MjU0NTE3NjIwNDQ5NjkxIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 5c6390cd4fd12a561fafbb897752c0c703b5b6f19ab5e9cb772e5a7b3453de83 |
| hovercard-subject-tag | issue:2370321450 |
| 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/28444/issue_layout |
| twitter:image | https://opengraph.githubassets.com/0bd63aaa74d0623ca7402ae52f0a72d99a7122c57de7e1d86358caab079417b8/matplotlib/matplotlib/issues/28444 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/0bd63aaa74d0623ca7402ae52f0a72d99a7122c57de7e1d86358caab079417b8/matplotlib/matplotlib/issues/28444 |
| og:image:alt | Summary From #28403 (review): Current logic Extract all data coordinates xyz from the artist and feed them into auto_scale_xyz(). This updates the xy_dataLim, zz_dataLim BBoxes via .Bbox.update_fro... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | timhoffm |
| 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