Title: [Bug]: ax.text() box size determined incorrectly for *-subscript (cuts off text at bottom) · Issue #31481 · matplotlib/matplotlib · GitHub
Open Graph Title: [Bug]: ax.text() box size determined incorrectly for *-subscript (cuts off text at bottom) · Issue #31481 · matplotlib/matplotlib
X Title: [Bug]: ax.text() box size determined incorrectly for *-subscript (cuts off text at bottom) · Issue #31481 · matplotlib/matplotlib
Description: Bug summary Hello everyone, I have the case that I want to add some texual data to a plot. Therefore I need an subscript index for my math-symbol, which became *. It turned out that the text-box cuts off the bottom of the text when just ...
Open Graph Description: Bug summary Hello everyone, I have the case that I want to add some texual data to a plot. Therefore I need an subscript index for my math-symbol, which became *. It turned out that the text-box cu...
X Description: Bug summary Hello everyone, I have the case that I want to add some texual data to a plot. Therefore I need an subscript index for my math-symbol, which became *. It turned out that the text-box cu...
Opengraph URL: https://github.com/matplotlib/matplotlib/issues/31481
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"[Bug]: ax.text() box size determined incorrectly for *-subscript (cuts off text at bottom)","articleBody":"### Bug summary\n\nHello everyone,\n\nI have the case that I want to add some texual data to a plot. Therefore I need an subscript index for my math-symbol, which became *. It turned out that the text-box cuts off the bottom of the text when just givin * as subscript.\n\nI have created a sample code below which shows the following behaviour:\n\n\u003cimg width=\"636\" height=\"477\" alt=\"Image\" src=\"https://github.com/user-attachments/assets/a4bee15f-64bd-4038-a473-d6d73194c05f\" /\u003e\n\nI tried to overcome that issue by adding a protected space (~) behind * `r\"$\\pm \\sigma_{*~}$\"` but the space is ignored with respect to the box-calculation.\n\nBest regards,\nDeph\n\n### Code for reproduction\n\n```Python\nimport matplotlib.pyplot as plt\n\nfontSize = 40\nfig, ax = plt.subplots(nrows=1, ncols=1)\nax.plot([0, 10],\n [0, 10],\n )\nax.text(0.175, 0.35, r\"$\\pm \\sigma_{e*}$\" , transform=ax.transAxes, fontsize=fontSize, ha=\"left\" , va=\"top\")\nax.text(0.175, 0.19, r\"$\\pm \\sigma_{*}$\" , transform=ax.transAxes, fontsize=fontSize, ha=\"left\" , va=\"top\")\n```\n\n### Actual outcome\n\nSee screenshot.\n\n### Expected outcome\n\nText gets not clipped off at bottom\n\n### Additional information\n\nUpgraded all packages before issue with `pip freeze | %{$_.split('==')[0]} | %{pip install --upgrade $_}`\nNote: I tested rcparam `useTeX=True` which worked. However, by that the font changed to the TeX-font. If I consider now using the `usetex` option means I have to re-finetune the optic a ton of plots.\n\nIDE: VS-Code 1.114.0 (system setup)\nVS-Code Plugins: Microsoft Python Plugins Version 2026.4.0\n\n### Operating system\n\nWindows 11\n\n### Matplotlib Version\n\n3.10.8\n\n### Matplotlib Backend\n\n3.10.8\n\n### Python version\n\n3.14.3\n\n### Jupyter version\n\nN/A\n\n### Installation\n\npip","author":{"url":"https://github.com/Dephrilibrium","@type":"Person","name":"Dephrilibrium"},"datePublished":"2026-04-09T14:49:21.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":3},"url":"https://github.com/31481/matplotlib/issues/31481"}
| 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:f4e5b58c-5a3d-4a7a-ef25-3034c1080f3b |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | A690:20FEA0:D1E731:11F1561:6A521690 |
| html-safe-nonce | 02905909e1b22850c75b1678251c34501934b1eefd8941f7dedf1f2919b79662 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBNjkwOjIwRkVBMDpEMUU3MzE6MTFGMTU2MTo2QTUyMTY5MCIsInZpc2l0b3JfaWQiOiI1MjE5MjQ4NDg1MDA0Nzk2MzIiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 6faeecf8c7d93aff6da15b81e812c9ae67a5b7acdb62794912df573f92bb1701 |
| hovercard-subject-tag | issue:4233074135 |
| 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/31481/issue_layout |
| twitter:image | https://opengraph.githubassets.com/3ff5c494e6e1d2c4c3110072ebf905781ce2ef3e7f571c6c0f5b9b3c8c3b62ad/matplotlib/matplotlib/issues/31481 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/3ff5c494e6e1d2c4c3110072ebf905781ce2ef3e7f571c6c0f5b9b3c8c3b62ad/matplotlib/matplotlib/issues/31481 |
| og:image:alt | Bug summary Hello everyone, I have the case that I want to add some texual data to a plot. Therefore I need an subscript index for my math-symbol, which became *. It turned out that the text-box cu... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | Dephrilibrium |
| 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