Title: layout.grid enhancements for plotly.py to replace make_subplots · Issue #3507 · plotly/plotly.js · GitHub
Open Graph Title: layout.grid enhancements for plotly.py to replace make_subplots · Issue #3507 · plotly/plotly.js
X Title: layout.grid enhancements for plotly.py to replace make_subplots · Issue #3507 · plotly/plotly.js
Description: Background plotly.py has a system for building figures with subplots that predates the plotly.js layout.grid system for subplots. I would like to replace this custom subplot system with layout.grid to reduce complexity inside plotly.py a...
Open Graph Description: Background plotly.py has a system for building figures with subplots that predates the plotly.js layout.grid system for subplots. I would like to replace this custom subplot system with layout.grid...
X Description: Background plotly.py has a system for building figures with subplots that predates the plotly.js layout.grid system for subplots. I would like to replace this custom subplot system with layout.grid...
Opengraph URL: https://github.com/plotly/plotly.js/issues/3507
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"layout.grid enhancements for plotly.py to replace make_subplots","articleBody":"### Background\r\nplotly.py has a system for building figures with subplots that predates the plotly.js `layout.grid` system for subplots. I would like to replace this custom subplot system with `layout.grid` to reduce complexity inside plotly.py and add support for all trace types (plotly.py's system only supports Cartesian subplot types). This transition will also make the integration of `px` into plotly.py much smoother.\r\n\r\n### Needs\r\nAs far as I can tell, there are two features that are implemented in plotly.py's `make_subplots` function that are not supported by layout.grid. \r\n\r\nThe first two are both demonstrated in this example https://plot.ly/python/subplots/#custom-sized-subplot-with-subplot-titles.\r\n\r\n 1) Spanned subplots: `make_subplots` allows individual axes to span multiple subplot grid entries\r\n 2) Subplot titles: `make_subplots` has a system for positioning text annotations as titles for individual subplots\r\n 3) column/row widths: `make_subplots` supports `column_width` and `row_width` arrays to support non-uniform widths of the rows and columns in the grid.\r\n 4) insets: `make_subplots` supports the specification of insets. TBH I'm not really sure how this works and I don't know if there are any examples of this outside of the docstring. And this might not be something that makes sense to support in `layout.grid`. Here's the docstring\r\n\r\n```\r\n insets (kwarg, list of dictionaries):\r\n Inset specifications.\r\n\r\n - Each item in 'insets' is a dictionary.\r\n The available keys are:\r\n\r\n * cell (tuple, default=(1,1)): (row, col) index of the\r\n subplot cell to overlay inset axes onto.\r\n * is_3d (boolean, default=False): flag for 3d scenes\r\n * l (float, default=0.0): padding left of inset\r\n in fraction of cell width\r\n * w (float or 'to_end', default='to_end') inset width\r\n in fraction of cell width ('to_end': to cell right edge)\r\n * b (float, default=0.0): padding bottom of inset\r\n in fraction of cell height\r\n * h (float or 'to_end', default='to_end') inset height\r\n in fraction of cell height ('to_end': to cell top edge)\r\n```\r\n\r\n### API ideas\r\nTo kick things off, here's a idea for a potential plotly.js API\r\n\r\n 1) We could add `layout.grid.rowspan` and `layout.grid.colspan` properties that may optionally be set to 2D arrays of integers. So the example above would have a a `colspan` property of\r\n\r\n```\r\n[[1, 1],\r\n [2, 0]]\r\n```\r\nwhich would imply a `grid.subplots` property of \r\n```\r\n[['xy' , 'x2y2'],\r\n ['x3y3', null]]\r\n```\r\n\r\n2) We could add a `grid.titles` property that is a 2D array of title strings. So the example above would have a `grid.titles` property of\r\n```\r\n[['First Subplot', 'Second Subplot'],\r\n ['Third Subplot' , null]]\r\n```\r\n\r\n3) We could add `grid.widths` and `grid.heights` properties that would be 1D arrays of numbers. We could internally normalize each array and use the elements to determine the width/height of each column/row.\r\n\r\ncc @nicolaskruchten ","author":{"url":"https://github.com/jonmmease","@type":"Person","name":"jonmmease"},"datePublished":"2019-02-02T13:52:08.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":5},"url":"https://github.com/3507/plotly.js/issues/3507"}
| 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:47f24f5b-4e8a-44d0-ee81-cb30f2635c8e |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | A900:5B712:49323B:677CC9:6A57865B |
| html-safe-nonce | c6c5b610eaf657c7048c6d037cc55d03232f0cc972b915c677941757210eab8d |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBOTAwOjVCNzEyOjQ5MzIzQjo2NzdDQzk6NkE1Nzg2NUIiLCJ2aXNpdG9yX2lkIjoiOTc1MDkzNDAyMDIxODg5NjI3IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 001bf44c0b7d56a9a6ff75fcb3438589d2fb5419ed94d792d064811997ea8fb1 |
| hovercard-subject-tag | issue:405984895 |
| 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/plotly/plotly.js/3507/issue_layout |
| twitter:image | https://opengraph.githubassets.com/978fb5f4d1b219a0c8e056f4638cc05dcb5e7afb44890d58a421e9f3cfd46b92/plotly/plotly.js/issues/3507 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/978fb5f4d1b219a0c8e056f4638cc05dcb5e7afb44890d58a421e9f3cfd46b92/plotly/plotly.js/issues/3507 |
| og:image:alt | Background plotly.py has a system for building figures with subplots that predates the plotly.js layout.grid system for subplots. I would like to replace this custom subplot system with layout.grid... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | jonmmease |
| hostname | github.com |
| expected-hostname | github.com |
| None | c6353e56e94423c9cd5abde7708a859afa36a0c1203c73749055bf6ee6704cd0 |
| turbo-cache-control | no-preview |
| go-import | github.com/plotly/plotly.js git https://github.com/plotly/plotly.js.git |
| octolytics-dimension-user_id | 5997976 |
| octolytics-dimension-user_login | plotly |
| octolytics-dimension-repository_id | 45646037 |
| octolytics-dimension-repository_nwo | plotly/plotly.js |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 45646037 |
| octolytics-dimension-repository_network_root_nwo | plotly/plotly.js |
| 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 | f59ab1c46b638204e2aea09126d089be5dc773b7 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width