Title: new "layout" class · Issue #20055 · matplotlib/matplotlib · GitHub
Open Graph Title: new "layout" class · Issue #20055 · matplotlib/matplotlib
X Title: new "layout" class · Issue #20055 · matplotlib/matplotlib
Description: As a follow on to #19892 Currently we have two layout engines, and #19892 proposes to access them with a figure(layout='constrained'/'tight') kwarg and to discourage constrained_layout=True and tight_layout=True. As a follow up, it would...
Open Graph Description: As a follow on to #19892 Currently we have two layout engines, and #19892 proposes to access them with a figure(layout='constrained'/'tight') kwarg and to discourage constrained_layout=True and tig...
X Description: As a follow on to #19892 Currently we have two layout engines, and #19892 proposes to access them with a figure(layout='constrained'/'tight') kwarg and to discourage constrained_lay...
Opengraph URL: https://github.com/matplotlib/matplotlib/issues/20055
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"new \"layout\" class","articleBody":"As a follow on to https://github.com/matplotlib/matplotlib/pull/19892\r\n\r\nCurrently we have two layout engines, and https://github.com/matplotlib/matplotlib/pull/19892 proposes to access them with a `figure(layout='constrained'/'tight')` kwarg and to discourage `constrained_layout=True` and `tight_layout=True`. \r\n\r\nAs a follow up, it would be good to create a new base class `class Layout` (or `FigureLayout`) that has subclasses `class ConstrainedLayout` and `class TightLayout` but could also have more, and/or user-defined subclasses. This would improve option handling: `figure(layout=ConstrainedLayout(wspace=0.2))` instead of passing a hard-to-document dict.\r\n\r\nThe parent would probably need an `__init__` and an `execute` method, and probably a bunch of setters for the various settings. \r\n\r\nThis would give us scope to define more layout engines or light wrappers around the existing ones. For instance, a frequently asked one, which is in proplot, is to have an inside-out layout where the axes sizes are fixed and the figure grows or shrinks to accommodate. \r\n\r\nThis would make the layout manager hot swappable as well, if it only did all its work at draw. \r\n\r\nThis would also remove state from `Figure` and `Gridspec`, though it would add state back to `Figure` in the `fig._layout` parameter. To implement, we would add to `Figure.draw()`:\r\n\r\n```python\r\nif self._layout is not None:\r\n self._layout.execute()\r\n```\r\n\r\n","author":{"url":"https://github.com/jklymak","@type":"Person","name":"jklymak"},"datePublished":"2021-04-23T17:58:00.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":1},"url":"https://github.com/20055/matplotlib/issues/20055"}
| 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:8c9ba0ae-41ea-9687-d0b1-61e52e8bd928 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | D630:199219:2782E9E:3478FA2:6A521680 |
| html-safe-nonce | 74fece291ba124467e805d43f64fc927acd657a08aef0038ea55c012a6da336a |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJENjMwOjE5OTIxOToyNzgyRTlFOjM0NzhGQTI6NkE1MjE2ODAiLCJ2aXNpdG9yX2lkIjoiMzg5NjM4MjA3MDU4MzMzNDUyOCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | ba125c69625a084acfbff7df90c5f1888472ca1c82e6bbad532bd8fbf8e1d294 |
| hovercard-subject-tag | issue:866320996 |
| 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/20055/issue_layout |
| twitter:image | https://opengraph.githubassets.com/81209a3576d4c803b0abe6b1cdede0af028f44ac06eb72542ed147eb3d43b3d6/matplotlib/matplotlib/issues/20055 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/81209a3576d4c803b0abe6b1cdede0af028f44ac06eb72542ed147eb3d43b3d6/matplotlib/matplotlib/issues/20055 |
| og:image:alt | As a follow on to #19892 Currently we have two layout engines, and #19892 proposes to access them with a figure(layout='constrained'/'tight') kwarg and to discourage constrained_layout=True and tig... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | jklymak |
| 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