Title: [Bug]: Offset notation on y-axis can overlap with a long title · Issue #23379 · matplotlib/matplotlib · GitHub
Open Graph Title: [Bug]: Offset notation on y-axis can overlap with a long title · Issue #23379 · matplotlib/matplotlib
X Title: [Bug]: Offset notation on y-axis can overlap with a long title · Issue #23379 · matplotlib/matplotlib
Description: Bug summary Offset notation on the y-axis creates a "+1" or similar marker that overlaps a long title. Code for reproduction import matplotlib.pyplot as plt import random random.seed(123) x = [n for n in range(100)] y = [1 + random.rando...
Open Graph Description: Bug summary Offset notation on the y-axis creates a "+1" or similar marker that overlaps a long title. Code for reproduction import matplotlib.pyplot as plt import random random.seed(123) x = [n fo...
X Description: Bug summary Offset notation on the y-axis creates a "+1" or similar marker that overlaps a long title. Code for reproduction import matplotlib.pyplot as plt import random random.seed(123)...
Opengraph URL: https://github.com/matplotlib/matplotlib/issues/23379
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"[Bug]: Offset notation on y-axis can overlap with a long title","articleBody":"### Bug summary\r\n\r\n[Offset notation on the y-axis](https://matplotlib.org/stable/api/ticker_api.html#matplotlib.ticker.ScalarFormatter) creates a \"+1\" or similar marker that overlaps a long title.\r\n\r\n### Code for reproduction\r\n\r\n```python\r\nimport matplotlib.pyplot as plt\r\nimport random\r\nrandom.seed(123)\r\nx = [n for n in range(100)]\r\ny = [1 + random.random()/1000 for _ in range(100)]\r\nfig, ax = plt.subplots()\r\nax.plot(x, y, '.-', label=\"random values near 1.0\")\r\nax.set_title('abcdefghijklmnopqrstuvwxyz' + ' test ' + ' abcdefghijklmnopqrstuvwxyz')\r\nax.set_ylabel(\"y\")\r\nax.set_xlabel(\"x\")\r\nax.legend()\r\nfig.savefig(\"example.png\")\r\nplt.show()\r\n```\r\n\r\n\r\n### Actual outcome\r\n\r\n\r\n\r\n\r\n### Expected outcome\r\n\r\n\r\n\r\n\r\n### Additional information\r\n\r\nThere are workarounds such as passing arguments like `y=1.03` or `pad=15` to `set_title()` to push the title up manually. However, this should not be necessary as the [documentation says](https://matplotlib.org/stable/api/_as_gen/matplotlib.axes.Axes.set_title.html?highlight=set_title#matplotlib.axes.Axes.set_title) \"y is determined automatically to avoid decorators on the Axes\" (see [pull request #17127](https://github.com/matplotlib/matplotlib/pull/17127)). Note also that setting `constrained_layout=True` does not change the output.\r\n\r\n### Operating system\r\n\r\nWindows 10\r\n\r\n### Matplotlib Version\r\n\r\n3.4.3\r\n\r\n### Matplotlib Backend\r\n\r\nmodule://matplotlib_inline.backend_inline\r\n\r\n### Python version\r\n\r\n3.9.7\r\n\r\n### Jupyter version\r\n\r\n6.4.5\r\n\r\n### Installation\r\n\r\nconda","author":{"url":"https://github.com/nbeaver","@type":"Person","name":"nbeaver"},"datePublished":"2022-07-01T16:12:30.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":7},"url":"https://github.com/23379/matplotlib/issues/23379"}
| 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:e335a220-b903-d3ad-1f54-29b3a3422944 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | D3C6:B6D9A:171D615:1ECF544:6A52BBE9 |
| html-safe-nonce | bc72b460df368e9d451a15cef82be4642ec49f7cb46fc2fca50ced45114fa535 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEM0M2OkI2RDlBOjE3MUQ2MTU6MUVDRjU0NDo2QTUyQkJFOSIsInZpc2l0b3JfaWQiOiI0MjkyNTE0MjgzMDQ3MjcxNDAxIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | acbc14f5984265c3a84c4ed109e2a0038f3736f6b535236bcd2abed6b610709c |
| hovercard-subject-tag | issue:1291592300 |
| 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/23379/issue_layout |
| twitter:image | https://opengraph.githubassets.com/04a79b40cf9148fc9af22c417edabda4fc1cac2ab7eede57bbb77b2abf1ac01c/matplotlib/matplotlib/issues/23379 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/04a79b40cf9148fc9af22c417edabda4fc1cac2ab7eede57bbb77b2abf1ac01c/matplotlib/matplotlib/issues/23379 |
| og:image:alt | Bug summary Offset notation on the y-axis creates a "+1" or similar marker that overlaps a long title. Code for reproduction import matplotlib.pyplot as plt import random random.seed(123) x = [n fo... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | nbeaver |
| 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 | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width