Title: [Bug]: Initial save ignores text in a figure with constrained layout · Issue #31147 · matplotlib/matplotlib · GitHub
Open Graph Title: [Bug]: Initial save ignores text in a figure with constrained layout · Issue #31147 · matplotlib/matplotlib
X Title: [Bug]: Initial save ignores text in a figure with constrained layout · Issue #31147 · matplotlib/matplotlib
Description: Bug summary The text is added below the axes by calling ax.text(0.0, -0.5, f"My Text") in a figure with constrained layout, but the initial save does not contain the text. Code for reproduction import matplotlib.pyplot as plt fig = plt.f...
Open Graph Description: Bug summary The text is added below the axes by calling ax.text(0.0, -0.5, f"My Text") in a figure with constrained layout, but the initial save does not contain the text. Code for reproduction imp...
X Description: Bug summary The text is added below the axes by calling ax.text(0.0, -0.5, f"My Text") in a figure with constrained layout, but the initial save does not contain the text. Code for reprod...
Opengraph URL: https://github.com/matplotlib/matplotlib/issues/31147
X: @github
Domain: github.com
IPv4 address: 140.82.114.4
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"[Bug]: Initial save ignores text in a figure with constrained layout","articleBody":"### Bug summary\n\nThe text is added below the axes by calling ax.text(0.0, -0.5, f\"My Text\") in a figure with constrained layout, but the initial save does not contain the text. \n\n### Code for reproduction\n\n```Python\nimport matplotlib.pyplot as plt\n\nfig = plt.figure(layout='constrained')\nax = fig.add_subplot()\nax.text(0.0, -0.5, f\"My Text\")\n \nplt.savefig('save1.png')\nplt.savefig('save2.png')\n```\n\n### Actual outcome\n\n### save1.png\n\u003cimg width=\"640\" height=\"480\" alt=\"Image\" src=\"https://github.com/user-attachments/assets/c5915ef3-898e-4a53-9918-f96853a9d069\" />\n\n### save2.png\n\u003cimg width=\"640\" height=\"480\" alt=\"Image\" src=\"https://github.com/user-attachments/assets/b8626e43-db92-441c-b7da-57afcc6f7f29\" />\n\n### Expected outcome\n\nsave1.png and save2.png should be identical and both contain \"My Text\".\n\n### Additional information\n\n_No response_\n\n### Operating system\n\n_No response_\n\n### Matplotlib Version\n\n3.10.8\n\n### Matplotlib Backend\n\n_No response_\n\n### Python version\n\n_No response_\n\n### Jupyter version\n\n_No response_\n\n### Installation\n\nNone","author":{"url":"https://github.com/smith2936","@type":"Person","name":"smith2936"},"datePublished":"2026-02-13T06:20:25Z","url":"https://github.com/matplotlib/matplotlib/issues/31147"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| 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:678634bc-762a-1efc-6c75-28c09aa12853 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 9D0E:83BF7:11C1372:1771F14:6B065381 |
| html-safe-nonce | 867a9abc5b2c96d459512a7d290532d74e6ec6654e86c4ed2e98419651e02bf1 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5RDBFOjgzQkY3OjExQzEzNzI6MTc3MUYxNDo2QjA2NTM4MSIsInZpc2l0b3JfaWQiOiI2OTQ5NDIwMzIxMjUwNjI4NDgyIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 5c86dab36d3e4b0a29ef01ef49fe63fff30f5bddc58f91469629ae894ae94001 |
| hovercard-subject-tag | issue:3935576331 |
| 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/31147/issue_layout |
| twitter:image | https://opengraph.githubassets.com/93d11e87039b1c09d6a65fbe83b5e3f8471a27f9d4f4a0a3c7d4560bed6a86bf/matplotlib/matplotlib/issues/31147 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/93d11e87039b1c09d6a65fbe83b5e3f8471a27f9d4f4a0a3c7d4560bed6a86bf/matplotlib/matplotlib/issues/31147 |
| og:image:alt | Bug summary The text is added below the axes by calling ax.text(0.0, -0.5, f"My Text") in a figure with constrained layout, but the initial save does not contain the text. Code for reproduction imp... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | smith2936 |
| hostname | github.com |
| expected-hostname | github.com |
| None | 6324e6ac990fb6befbec840cc0e102a1071c339bfe8f9826bb12de2e3ba1d297 |
| 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 | 7f0aa75f4141d440c6110dc31af7ea7797abb6c4 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
| Server | github.com |
| Content-Type | text/html; charset=utf-8 |
| Cache-Control | max-age=0, private, must-revalidate |
Viewport: width=device-width