Title: [Bug]: Layout Managers are confused by complex arrangement of sub-figures and gridspec's · Issue #30076 · matplotlib/matplotlib · GitHub
Open Graph Title: [Bug]: Layout Managers are confused by complex arrangement of sub-figures and gridspec's · Issue #30076 · matplotlib/matplotlib
X Title: [Bug]: Layout Managers are confused by complex arrangement of sub-figures and gridspec's · Issue #30076 · matplotlib/matplotlib
Description: Bug summary When I run the code below compressed.png and constrained.png are (visually) identical, and the axes in the left of each sub-figure are getting smaller and smaller tight.png has all the axes in each sub-figure the same sizes, ...
Open Graph Description: Bug summary When I run the code below compressed.png and constrained.png are (visually) identical, and the axes in the left of each sub-figure are getting smaller and smaller tight.png has all the ...
X Description: Bug summary When I run the code below compressed.png and constrained.png are (visually) identical, and the axes in the left of each sub-figure are getting smaller and smaller tight.png has all the ...
Opengraph URL: https://github.com/matplotlib/matplotlib/issues/30076
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"[Bug]: Layout Managers are confused by complex arrangement of sub-figures and gridspec's","articleBody":"### Bug summary\n\nWhen I run the code below\n\n1. `compressed.png` and `constrained.png` are (visually) identical, and the axes in the left of each sub-figure are getting smaller and smaller\n2. `tight.png` has all the axes in each sub-figure the same sizes, but those sizes are wrong\n3. `none.png` is correct (all the sizes remain unchanged, the sizes are OK) but the axes decorations overlap the plotting area\n\nFor your convenience I've uploaded the image files produced by my code.\n\nThank you in advance — gb\n\n---\n\nThis behaviour was brought to my attention by\nhttps://stackoverflow.com/questions/79614691/why-are-the-subplots-in-the-subfigures-getting-smaller\n\n\n### Code for reproduction\n\n```Python\nimport matplotlib.pyplot as plt\n\n\ndef test(layout):\n fig = plt.figure(figsize=(12, 16), layout=layout)\n figures = fig.subfigures(4, 2)\n\n for f in figures.flatten():\n gs = f.add_gridspec(3, 2)\n for i in range(3):\n f.add_subplot(gs[i, 0]).plot()\n f.add_subplot(gs[:, 1]).plot()\n fig.savefig(layout + \".png\")\n\n\ntest(\"compressed\")\ntest(\"constrained\")\ntest(\"none\")\ntest(\"tight\")\n```\n\n### Actual outcome\n\n\n\n\n\n\n### Expected outcome\n\nSomething like `none.png` w/o the axes decoration overlapping the plot areas\n\n### Additional information\n\n_No response_\n\n### Operating system\n\nOpen Suse Tumbleweed\n\n### Matplotlib Version\n\n3.10.1\n\n### Matplotlib Backend\n\nqtagg\n\n### Python version\n\nPython 3.13.3\n\n### Jupyter version\n\n_No response_\n\n### Installation\n\nLinux package manager","author":{"url":"https://github.com/boffi","@type":"Person","name":"boffi"},"datePublished":"2025-05-19T10:01:57.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":4},"url":"https://github.com/30076/matplotlib/issues/30076"}
| 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:912baf08-8606-82dc-25e9-6e9b9cc3a6dc |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | D76C:1A8C4D:B0CFA4:F058F5:6A5209A4 |
| html-safe-nonce | f41af3bb487f40e1c6475d0b7b7c73bba3b4a0c7361901bc0f3c42ba6473c132 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJENzZDOjFBOEM0RDpCMENGQTQ6RjA1OEY1OjZBNTIwOUE0IiwidmlzaXRvcl9pZCI6IjEwMTcyMDE0Mjg4OTUyMzg1NjQiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 0499d931d473a872503b6b59cb614368dd2fcb1278788f1a51ec45fe6c0d3c4f |
| hovercard-subject-tag | issue:3073270788 |
| 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/30076/issue_layout |
| twitter:image | https://opengraph.githubassets.com/7325094e61fef2e8bd0ecff8aa0d5532949b0c4b037d35c3e6b69c29bb9c2b02/matplotlib/matplotlib/issues/30076 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/7325094e61fef2e8bd0ecff8aa0d5532949b0c4b037d35c3e6b69c29bb9c2b02/matplotlib/matplotlib/issues/30076 |
| og:image:alt | Bug summary When I run the code below compressed.png and constrained.png are (visually) identical, and the axes in the left of each sub-figure are getting smaller and smaller tight.png has all the ... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | boffi |
| 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