Title: [Bug]: Labels don't get wrapped when set_yticks() is used in subplots · Issue #28358 · matplotlib/matplotlib · GitHub
Open Graph Title: [Bug]: Labels don't get wrapped when set_yticks() is used in subplots · Issue #28358 · matplotlib/matplotlib
X Title: [Bug]: Labels don't get wrapped when set_yticks() is used in subplots · Issue #28358 · matplotlib/matplotlib
Description: Bug summary When plotting bar charts in subplots with very long labels, the option of wrapping text only works on the first plotted subplot, despite passing wrap=True to set_yticks() in both cases. Code for reproduction import matplotlib...
Open Graph Description: Bug summary When plotting bar charts in subplots with very long labels, the option of wrapping text only works on the first plotted subplot, despite passing wrap=True to set_yticks() in both cases....
X Description: Bug summary When plotting bar charts in subplots with very long labels, the option of wrapping text only works on the first plotted subplot, despite passing wrap=True to set_yticks() in both cases....
Opengraph URL: https://github.com/matplotlib/matplotlib/issues/28358
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"[Bug]: Labels don't get wrapped when set_yticks() is used in subplots","articleBody":"### Bug summary\r\n\r\nWhen plotting bar charts in subplots with very long labels, the option of wrapping text only works on the first plotted subplot, despite passing `wrap=True` to `set_yticks()` in both cases.\r\n\r\n### Code for reproduction\r\n\r\n```Python\r\nimport matplotlib.pyplot as plt\r\nimport numpy as np\r\n\r\nlong_text_label = 'very long category label i want to wrap'\r\nlabels = [f\"{long_text_label}_{i}\" for i in range(5)]\r\nvalues = np.arange(1, 6)\r\n\r\nfig, axes = plt.subplots(1, 2)\r\n\r\naxes[0].barh(np.arange(len(labels)), values)\r\naxes[0].set_yticks(np.arange(len(labels)), labels=labels, wrap=True)\r\n\r\naxes[1].barh(np.arange(len(labels)), values)\r\naxes[1].set_yticks(np.arange(len(labels)), labels=labels, wrap=True)\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\nThe label text on the y axis should appear wrapped on both subplots\r\n\r\n### Additional information\r\n\r\n_No response_\r\n\r\n### Operating system\r\n\r\nmacOS 14.4 (23E214)\r\n\r\n### Matplotlib Version\r\n\r\n3.8.3\r\n\r\n### Matplotlib Backend\r\n\r\nmodule://matplotlib_inline.backend_inline\r\n\r\n### Python version\r\n\r\nPython 3.11.8\r\n\r\n### Jupyter version\r\n\r\n4.2.0\r\n\r\n### Installation\r\n\r\npip","author":{"url":"https://github.com/soogui","@type":"Person","name":"soogui"},"datePublished":"2024-06-07T11:37:25.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":8},"url":"https://github.com/28358/matplotlib/issues/28358"}
| 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:617b8c6e-3f1f-3855-d443-be92b7351efb |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 8344:2D857A:2E7F835:3F9E4E4:6A53DA02 |
| html-safe-nonce | b58c7daca26093830d423ee776bcd481b96b396c25cae3e9d9d97178816f8bd1 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4MzQ0OjJEODU3QToyRTdGODM1OjNGOUU0RTQ6NkE1M0RBMDIiLCJ2aXNpdG9yX2lkIjoiNjAyNjU2MjM2MzY2OTc3NTM4IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 4fee9228e4ba94e757a5f69ed3c9204e7f655fe620ebd1ac8be68ebbde540920 |
| hovercard-subject-tag | issue:2340251168 |
| 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/28358/issue_layout |
| twitter:image | https://opengraph.githubassets.com/b245af59c297bd65e8de51a0db262e8ccc5decdbcfd8f275979adc848402be0f/matplotlib/matplotlib/issues/28358 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/b245af59c297bd65e8de51a0db262e8ccc5decdbcfd8f275979adc848402be0f/matplotlib/matplotlib/issues/28358 |
| og:image:alt | Bug summary When plotting bar charts in subplots with very long labels, the option of wrapping text only works on the first plotted subplot, despite passing wrap=True to set_yticks() in both cases.... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | soogui |
| 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