Title: [Bug]: Incorrect crop after constrained layout with equal aspect ratio and bbox_inches = tight · Issue #24133 · matplotlib/matplotlib · GitHub
Open Graph Title: [Bug]: Incorrect crop after constrained layout with equal aspect ratio and bbox_inches = tight · Issue #24133 · matplotlib/matplotlib
X Title: [Bug]: Incorrect crop after constrained layout with equal aspect ratio and bbox_inches = tight · Issue #24133 · matplotlib/matplotlib
Description: Bug summary When setting rcParams['figure.constrained_layout.use'] = True and ax.set_aspect('equal'), and saving with bbox_inches = 'tight', the resulting figure is cropped incorrectly. Code for reproduction import matplotlib as mpl impo...
Open Graph Description: Bug summary When setting rcParams['figure.constrained_layout.use'] = True and ax.set_aspect('equal'), and saving with bbox_inches = 'tight', the resulting figure is cropped incorrectly. Code for re...
X Description: Bug summary When setting rcParams['figure.constrained_layout.use'] = True and ax.set_aspect('equal'), and saving with bbox_inches = 'tight', the resulting figure is cropped ...
Opengraph URL: https://github.com/matplotlib/matplotlib/issues/24133
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"[Bug]: Incorrect crop after constrained layout with equal aspect ratio and bbox_inches = tight","articleBody":"### Bug summary\n\nWhen setting `rcParams['figure.constrained_layout.use'] = True` and `ax.set_aspect('equal')`, and saving with `bbox_inches = 'tight'`, the resulting figure is cropped incorrectly.\n\n### Code for reproduction\n\n```python\nimport matplotlib as mpl\r\nimport matplotlib.pyplot as plt\r\n\r\nmpl.rcParams['figure.constrained_layout.use'] = True\r\n\r\nfig, ax = plt.subplots()\r\n\r\nax.plot([0, 1])\r\nax.set_xlim(0, 1)\r\nax.set_aspect('equal')\r\n\r\nfig.savefig('test.png', bbox_inches = 'tight')\n```\n\n\n### Actual outcome\n\n```\r\nMatplotlibDeprecationWarning: The resize_event function was deprecated in Matplotlib 3.6 and will be removed two minor releases later. Use callbacks.process('resize_event', ResizeEvent(...)) instead.\r\n fig, ax = plt.subplots()\r\n```\r\n\r\n\n\n### Expected outcome\n\nIf I leave out `mpl.rcParams['figure.constrained_layout.use'] = True`, but call `subplots` with `layout = 'constrained'`, the saved figure is as expected:\r\n\r\n\r\n(The deprecation warning is probably the same is in [#23921](https://github.com/matplotlib/matplotlib/issues/23921), and appears in both cases.)\n\n### Additional information\n\n_No response_\n\n### Operating system\n\nmacOS Monterey\n\n### Matplotlib Version\n\n3.6.0\n\n### Matplotlib Backend\n\nmacOSX\n\n### Python version\n\n3.10.6\n\n### Jupyter version\n\n_No response_\n\n### Installation\n\npip","author":{"url":"https://github.com/konradmarx","@type":"Person","name":"konradmarx"},"datePublished":"2022-10-09T15:28:17.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":4},"url":"https://github.com/24133/matplotlib/issues/24133"}
| 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:19948a3c-0192-e11a-1772-35eee90cd5e0 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | D2B2:1880B3:17D8EF7:21D697F:6A50BF83 |
| html-safe-nonce | 1745c2b783196904f5138b4a82afc3f987934f79d8be5acc877e14ab6618c4e3 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEMkIyOjE4ODBCMzoxN0Q4RUY3OjIxRDY5N0Y6NkE1MEJGODMiLCJ2aXNpdG9yX2lkIjoiNzE1OTAyODE0NzA1NjMyODU3OSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | a9c3110aa365e4189fc582a1da92eaee8864d2ffff810004ae8159a31b235430 |
| hovercard-subject-tag | issue:1402308968 |
| 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/24133/issue_layout |
| twitter:image | https://opengraph.githubassets.com/cd8961d56a3663390f05868b099f86a5e2d6ae2086bb1289135583f145504a63/matplotlib/matplotlib/issues/24133 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/cd8961d56a3663390f05868b099f86a5e2d6ae2086bb1289135583f145504a63/matplotlib/matplotlib/issues/24133 |
| og:image:alt | Bug summary When setting rcParams['figure.constrained_layout.use'] = True and ax.set_aspect('equal'), and saving with bbox_inches = 'tight', the resulting figure is cropped incorrectly. Code for re... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | konradmarx |
| hostname | github.com |
| expected-hostname | github.com |
| None | 72b13e0e8d0319acdd27a145cfe73f4f06c791713d0ac4690e41fb68ad28cac0 |
| 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 | 08e79d53fc070870d5b168356afebb1e286a2ffe |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width