Title: Axis ticks are not aligned by baseline · Issue #4115 · matplotlib/matplotlib · GitHub
Open Graph Title: Axis ticks are not aligned by baseline · Issue #4115 · matplotlib/matplotlib
X Title: Axis ticks are not aligned by baseline · Issue #4115 · matplotlib/matplotlib
Description: Hi, it looks like the PGF backend defaults to top-align tick labels without accounting for the height of the letters. This works without problems with the PDF backend, also using Tex to render text does not make a difference. using this ...
Open Graph Description: Hi, it looks like the PGF backend defaults to top-align tick labels without accounting for the height of the letters. This works without problems with the PDF backend, also using Tex to render text...
X Description: Hi, it looks like the PGF backend defaults to top-align tick labels without accounting for the height of the letters. This works without problems with the PDF backend, also using Tex to render text...
Opengraph URL: https://github.com/matplotlib/matplotlib/issues/4115
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Axis ticks are not aligned by baseline","articleBody":"Hi, it looks like the PGF backend defaults to top-align tick labels without accounting for the height of the letters. This works without problems with the PDF backend, also using Tex to render text does not make a difference.\nusing this Python code:\n\n```\nimport matplotlib.pyplot as plt\nfig = plt.figure(figsize=(2,2))\nax = fig.add_subplot(111)\nax.plot([1,2],[5,7])\nax.set_xticks([1,2])\nax.set_xticklabels([\"up\",\"down\"])\nax.set_xlim([0,3]) # get the ticks closer together\nplt.tight_layout()\nfig.savefig(\"ticks_std.pdf\")\nfig.savefig(\"ticks_std.pgf\")\nfor lab in ax.xaxis.get_ticklabels():\n lab.set_verticalalignment(\"baseline\")\nfig.savefig(\"ticks_base.pdf\")\nfig.savefig(\"ticks_base.pgf\")\nfor lab in ax.xaxis.get_ticklabels():\n lab.set_verticalalignment(\"top\")\nfig.savefig(\"ticks_top.pdf\")\nfig.savefig(\"ticks_top.pgf\")\n```\n\n... and this Tex document:\n\n```\n\\documentclass{standalone}\n\\usepackage{tikz}\n\\begin{document}\n\\begin{tabular}{ccc}\n\\input{ticks_std.pgf} \u0026 \\input{ticks_base.pgf} \u0026 \\input{ticks_top.pgf} \\\\\n\\includegraphics{ticks_std.pdf} \u0026 \\includegraphics{ticks_base.pdf} \u0026 \\includegraphics{ticks_top.pdf}\n\\end{tabular}\n\\end{document} \n```\n\nproduces this:\n\n\nOne possible solution could be to use the baseline alignment with some additional padding depending on the font size.\n","author":{"url":"https://github.com/jowr","@type":"Person","name":"jowr"},"datePublished":"2015-02-17T11:30:26.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":11},"url":"https://github.com/4115/matplotlib/issues/4115"}
| 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:f110d87e-6105-1434-ea59-4f927a911050 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 8E9A:A6E9E:1088160:15F727B:6A541D07 |
| html-safe-nonce | ededd0cfa44cda91e51d09cf03dcdb93eafa0d4a3b621f780aa25e0cd5d9fb30 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4RTlBOkE2RTlFOjEwODgxNjA6MTVGNzI3Qjo2QTU0MUQwNyIsInZpc2l0b3JfaWQiOiI1MDUyMTM0MDU3NDIyNjI2MDU1IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 17102a502d11f82abcd0352685c1292f87590c41aa97ae259943d47a343b161d |
| hovercard-subject-tag | issue:57913138 |
| 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/4115/issue_layout |
| twitter:image | https://opengraph.githubassets.com/3b3b8a77ee487831b664ff6a692254283c54bc199f3a3d8bc5d51a747cefe533/matplotlib/matplotlib/issues/4115 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/3b3b8a77ee487831b664ff6a692254283c54bc199f3a3d8bc5d51a747cefe533/matplotlib/matplotlib/issues/4115 |
| og:image:alt | Hi, it looks like the PGF backend defaults to top-align tick labels without accounting for the height of the letters. This works without problems with the PDF backend, also using Tex to render text... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | jowr |
| 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