Title: [Bug]: Pyparsing warnings emitted in mathtext · Issue #25204 · matplotlib/matplotlib · GitHub
Open Graph Title: [Bug]: Pyparsing warnings emitted in mathtext · Issue #25204 · matplotlib/matplotlib
X Title: [Bug]: Pyparsing warnings emitted in mathtext · Issue #25204 · matplotlib/matplotlib
Description: Bug summary When plotting anything with at least one logarithmic axes (plt.semilogx(), plt.semilogy(), plt.loglog()) I get two warnings emitted due to code in _mathtext.py. These warnings are not emitted by default, but appears when runn...
Open Graph Description: Bug summary When plotting anything with at least one logarithmic axes (plt.semilogx(), plt.semilogy(), plt.loglog()) I get two warnings emitted due to code in _mathtext.py. These warnings are not e...
X Description: Bug summary When plotting anything with at least one logarithmic axes (plt.semilogx(), plt.semilogy(), plt.loglog()) I get two warnings emitted due to code in _mathtext.py. These warnings are not e...
Opengraph URL: https://github.com/matplotlib/matplotlib/issues/25204
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"[Bug]: Pyparsing warnings emitted in mathtext","articleBody":"### Bug summary\r\n\r\nWhen plotting anything with at least one logarithmic axes (`plt.semilogx()`, `plt.semilogy()`, `plt.loglog()`) I get two warnings emitted due to code in `_mathtext.py`. These warnings are not emitted by default, but appears when running Python with e.g. [`-Wdefault`](https://docs.python.org/3/using/cmdline.html#cmdoption-W).\r\n\r\n### Code for reproduction\r\n\r\n```python\r\nimport matplotlib.pyplot as plt\r\nplt.semilogx([1, 2], [3, 4])\r\nplt.savefig('plot.png')\r\n```\r\n\r\n\r\n### Actual outcome\r\n\r\n```\r\n/path/to/python/lib/python3.9/site-packages/matplotlib/_mathtext.py:1871: UserWarning: warn_name_set_on_empty_Forward: setting results name 'sym' on Forward expression that has no contained expression\r\n - p.placeable(\"sym\"))\r\n/path/to/python/lib/python3.9/site-packages/matplotlib/_mathtext.py:1876: UserWarning: warn_ungrouped_named_tokens_in_collection: setting results name 'name' on ZeroOrMore expression collides with 'name' on contained expression\r\n \"{\" + ZeroOrMore(p.simple | p.unknown_symbol)(\"name\") + \"}\")\r\n```\r\n\r\n### Expected outcome\r\n\r\nNo warnings/text should be printed.\r\n\r\n### Additional information\r\n\r\nTo see the warnings from the above code, save it to e.g. `test.py` and run it as either\r\n```bash\r\npython -Wdefault test.py\r\n```\r\nor\r\n```\r\nPYTHONWARNINGS=default python test.py\r\n```\r\n\r\nThe two warnings are triggered by the following lines within `matplotlib/_mathtext.py`:\r\n```python3\r\n p.accent \u003c\u003c= (\r\n csnames(\"accent\", [*self._accent_map, *self._wide_accents])\r\n - p.placeable(\"sym\")\r\n```\r\n\r\n```python3\r\n p.operatorname \u003c\u003c= cmd(\r\n r\"\\operatorname\",\r\n \"{\" + ZeroOrMore(p.simple | p.unknown_symbol)(\"name\") + \"}\")\r\n```\r\nwhere the various attributes on `p` are instances of `pyparsing.Forward`.\r\n\r\nThe warnings appear with Pyparsing versions 3.0.0–3.0.9 but not prior to 3.0.0 (e.g. 2.4.7). Also, the warnings only appear for Matplotlib versions 3.6.0–3.6.3, not e.g. 3.5.3\r\n\r\n\r\n### Operating system\r\n\r\nLinux Mint 20\r\n\r\n### Matplotlib Version\r\n\r\n3.6.3\r\n\r\n### Matplotlib Backend\r\n\r\nQtAgg\r\n\r\n### Python version\r\n\r\n3.8.5\r\n\r\n\r\n### Installation\r\n\r\npip","author":{"url":"https://github.com/jmd-dk","@type":"Person","name":"jmd-dk"},"datePublished":"2023-02-12T16:19:43.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":4},"url":"https://github.com/25204/matplotlib/issues/25204"}
| 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:649a93f6-021a-a4af-19c5-c99130e1ec80 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | D69C:1F14:361146F:4B11A12:6A50C401 |
| html-safe-nonce | 47600ac30a4c3d3443b05163f43f3c20d9ee29b7d07814e85d55035e793b353e |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJENjlDOjFGMTQ6MzYxMTQ2Rjo0QjExQTEyOjZBNTBDNDAxIiwidmlzaXRvcl9pZCI6Ijg1ODAwMjgwNjcwMzE4NjAyMjUiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 6f8f94676ae6b789388ffca82c9cad0e7684d77f2a6b869cf6121b63dfc065ba |
| hovercard-subject-tag | issue:1581318183 |
| 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/25204/issue_layout |
| twitter:image | https://opengraph.githubassets.com/39b5ae935a523bc52f7d0488f60bac63f34e607422a8acffb4475f6ab5c050cf/matplotlib/matplotlib/issues/25204 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/39b5ae935a523bc52f7d0488f60bac63f34e607422a8acffb4475f6ab5c050cf/matplotlib/matplotlib/issues/25204 |
| og:image:alt | Bug summary When plotting anything with at least one logarithmic axes (plt.semilogx(), plt.semilogy(), plt.loglog()) I get two warnings emitted due to code in _mathtext.py. These warnings are not e... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | jmd-dk |
| 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