Title: constrained_layout (sometimes) clips multiline title/xlabel/ylabel · Issue #13843 · matplotlib/matplotlib · GitHub
Open Graph Title: constrained_layout (sometimes) clips multiline title/xlabel/ylabel · Issue #13843 · matplotlib/matplotlib
X Title: constrained_layout (sometimes) clips multiline title/xlabel/ylabel · Issue #13843 · matplotlib/matplotlib
Description: Bug report Bug summary When a plot title/label consists of multiple lines (with some mathematics elements that require more vertical space), constrained_layout seems to not work correctly. Code for reproduction import matplotlib.pyplot a...
Open Graph Description: Bug report Bug summary When a plot title/label consists of multiple lines (with some mathematics elements that require more vertical space), constrained_layout seems to not work correctly. Code for...
X Description: Bug report Bug summary When a plot title/label consists of multiple lines (with some mathematics elements that require more vertical space), constrained_layout seems to not work correctly. Code for...
Opengraph URL: https://github.com/matplotlib/matplotlib/issues/13843
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"constrained_layout (sometimes) clips multiline title/xlabel/ylabel","articleBody":"\u003c!--To help us understand and resolve your issue, please fill out the form to the best of your ability.--\u003e\r\n\u003c!--You can feel free to delete the sections that do not apply.--\u003e\r\n\r\n### Bug report\r\n\r\n**Bug summary**\r\nWhen a plot title/label consists of multiple lines (with some mathematics elements that require more vertical space), constrained_layout seems to not work correctly.\r\n\u003c!--A short 1-2 sentences that succinctly describes the bug--\u003e\r\n\r\n**Code for reproduction**\r\n\r\n\u003c!--A minimum code snippet required to reproduce the bug.\r\nPlease make sure to minimize the number of dependencies required, and provide\r\nany necessary plotted data.\r\nAvoid using threads, as Matplotlib is (explicitly) not thread-safe.--\u003e\r\n\r\n```python\r\nimport matplotlib.pyplot as plt\r\nfig, ax = plt.subplots(figsize=(3, 3), constrained_layout=True)\r\nax.set_title('First line \\n'+r'Second line $\\frac{x}{y}$')\r\nax.set_ylabel('ylabel')\r\nax.set_xlabel('xlabel')\r\nfig.savefig('constrained_layout_issue.png')\r\n```\r\n\r\n**Actual outcome**\r\n\r\n\r\n\u003c!--The output produced by the above code, which may be a screenshot, console output, etc.--\u003e\r\n\r\nFor now, I am avoiding this issue by increasing `h_pad` with `plt.rcParams['figure.constrained_layout.h_pad'] = 6/72`. But this doesn't feel right (there is a lot more blank space left at the bottom of the plot).\r\n\r\n\r\n\r\n\u003c!--A description of the expected outcome from the code snippet--\u003e\r\n\u003c!--If this used to work in an earlier version of Matplotlib, please note the version it used to work on--\u003e\r\n\r\n**Matplotlib version**\r\n\u003c!--Please specify your platform and versions of the relevant libraries you are using:--\u003e\r\n * Operating system: Mac OS\r\n * Matplotlib version: 3.0.3\r\n * Matplotlib backend (`print(matplotlib.get_backend())`):\r\n * Python version: 3.7.3\r\n * Jupyter version (if applicable):\r\n * Other libraries: \r\n\r\n\u003c!--Please tell us how you installed matplotlib and python e.g., from source, pip, conda--\u003e\r\n\u003c!--If you installed from conda, please specify which channel you used if not the default--\u003e\r\n\r\n","author":{"url":"https://github.com/pharshalp","@type":"Person","name":"pharshalp"},"datePublished":"2019-04-02T14:21:18.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":3},"url":"https://github.com/13843/matplotlib/issues/13843"}
| 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:21911360-6e17-4776-5432-cf17139108c7 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 8A4A:2AB90B:2C4B724:3BD640B:6A53B9F7 |
| html-safe-nonce | cf754bc4dab25711622977d773fdda0e190cbfef2f34191b520eab3dc1e8fa1e |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4QTRBOjJBQjkwQjoyQzRCNzI0OjNCRDY0MEI6NkE1M0I5RjciLCJ2aXNpdG9yX2lkIjoiNTE5NDQxMTkxODYxODc2OTkxMSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | aa345dd0f0b416c80ed0bdc1c7dfb5b05d880fe6ab5898c372975329a624dcf4 |
| hovercard-subject-tag | issue:428257341 |
| 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/13843/issue_layout |
| twitter:image | https://opengraph.githubassets.com/e8be2ff5b788d34a2db3463f2e740b4dd45ebd7fd9fc96cdc9bdde23d08ae999/matplotlib/matplotlib/issues/13843 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/e8be2ff5b788d34a2db3463f2e740b4dd45ebd7fd9fc96cdc9bdde23d08ae999/matplotlib/matplotlib/issues/13843 |
| og:image:alt | Bug report Bug summary When a plot title/label consists of multiple lines (with some mathematics elements that require more vertical space), constrained_layout seems to not work correctly. Code for... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | pharshalp |
| 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 | 07a982c1d40157c619b364352b704c3ce66bb332 |
| ui-target | canary-2 |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width