Title: [Bug]: Axis.get_tick_space could take tick label rotation into account · Issue #32005 · matplotlib/matplotlib · GitHub
Open Graph Title: [Bug]: Axis.get_tick_space could take tick label rotation into account · Issue #32005 · matplotlib/matplotlib
X Title: [Bug]: Axis.get_tick_space could take tick label rotation into account · Issue #32005 · matplotlib/matplotlib
Description: Bug summary Axis.get_tick_space is used to determine (approximate) ticklabel size, which is then used to determine the number of ticks that can fit. Currently, this assumes that ticklabels are drawn horizontally, so rotating the tick lab...
Open Graph Description: Bug summary Axis.get_tick_space is used to determine (approximate) ticklabel size, which is then used to determine the number of ticks that can fit. Currently, this assumes that ticklabels are draw...
X Description: Bug summary Axis.get_tick_space is used to determine (approximate) ticklabel size, which is then used to determine the number of ticks that can fit. Currently, this assumes that ticklabels are draw...
Opengraph URL: https://github.com/matplotlib/matplotlib/issues/32005
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"[Bug]: Axis.get_tick_space could take tick label rotation into account","articleBody":"### Bug summary\n\nAxis.get_tick_space is used to determine (approximate) ticklabel size, which is then used to determine the number of ticks that can fit. Currently, this assumes that ticklabels are drawn horizontally, so rotating the tick labels can yield poor results. It would be nice if ticklabel rotation (as set by tick_params) was taken into account in the computation.\n\n### Code for reproduction\n\n```Python\nfrom pylab import *; rcdefaults()\n\nfig = figure(figsize=(1.8, 1.8), layout=\"constrained\")\nax = fig.add_subplot(xlim=(0, 1), ylim=(0, 1))\n\nfig = figure(figsize=(1.8, 1.8), layout=\"constrained\")\nax = fig.add_subplot(xlim=(0, 1), ylim=(0, 1))\nax.tick_params(rotation=90)\n\nshow()\n```\n\n### Actual outcome\n\n\u003cimg width=\"180\" height=\"180\" alt=\"Image\" src=\"https://github.com/user-attachments/assets/0df6d9cf-3737-4f3f-b85b-9a146c223230\" /\u003e\n\u003cimg width=\"180\" height=\"180\" alt=\"Image\" src=\"https://github.com/user-attachments/assets/1c913ff4-9276-465c-ad0b-88a23e4932d3\" /\u003e\n\nThe first figure has reasonably spaced ticklabels; the second figure has too many yticklabels and (maybe) too few xticklabels.\n\n### Expected outcome\n\nIn the second plot ~3 yticks (at 0, 0.5, 1) and 5-6 xticks (every 0.2 or every 0.25).\n\n### Additional information\n\n_No response_\n\n### Operating system\n\nmacos\n\n### Matplotlib Version\n\n3.12.0.dev263+g0677cc8c1\n\n### Matplotlib Backend\n\nany\n\n### Python version\n\nPython 3.14.0\n\n### Jupyter version\n\nENOSUCHLIB\n\n### Installation\n\ngit checkout","author":{"url":"https://github.com/anntzer","@type":"Person","name":"anntzer"},"datePublished":"2026-07-06T21:14:44.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":2},"url":"https://github.com/32005/matplotlib/issues/32005"}
| 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:a6b9c605-f757-9b22-617a-0ccbe1a382e7 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | AC1A:2F79D3:712297:A1042A:6A6307BE |
| html-safe-nonce | d821682dfbe7e7fdbda56ede2c6c7693195fc80157f301c759cd66223f1e81cf |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBQzFBOjJGNzlEMzo3MTIyOTc6QTEwNDJBOjZBNjMwN0JFIiwidmlzaXRvcl9pZCI6IjM4OTYxMzI4ODA4NzY4OTgyMzgiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 4eacefa673eb634d7051da35c46c8beebd3782171c218fc32c89a75199aeb905 |
| hovercard-subject-tag | issue:4823153275 |
| 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/32005/issue_layout |
| twitter:image | https://opengraph.githubassets.com/1f2d945d422c1d7b7a7653b40cb3e666faaed24591b011499d3b0f277cba0b4f/matplotlib/matplotlib/issues/32005 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/1f2d945d422c1d7b7a7653b40cb3e666faaed24591b011499d3b0f277cba0b4f/matplotlib/matplotlib/issues/32005 |
| og:image:alt | Bug summary Axis.get_tick_space is used to determine (approximate) ticklabel size, which is then used to determine the number of ticks that can fit. Currently, this assumes that ticklabels are draw... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | anntzer |
| hostname | github.com |
| expected-hostname | github.com |
| None | b48e7bf0b1945d51f303503b057abf666ce74c3efbe107b413db2bb921c3f012 |
| 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 | 9370f37042c29822d6ba7e3f670f0036a0155b21 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width