Title: FIX: make title move above ticklabels by jklymak · Pull Request #13741 · matplotlib/matplotlib · GitHub
Open Graph Title: FIX: make title move above ticklabels by jklymak · Pull Request #13741 · matplotlib/matplotlib
X Title: FIX: make title move above ticklabels by jklymak · Pull Request #13741 · matplotlib/matplotlib
Description: PR Summary Titles are supposed to avoid tick labels as of #9498. However, if ticks are labeled at the top and bottom of a plot, ax.xaxis.get_ticks_position() returns "unknown" instead of "top", so old logic didn't move title above tick labels on the top of the axes for that case. Closes #13735 import pandas as pd import numpy as np import string import matplotlib.pyplot as plt n = 10 names = ['Long Name ' + suffix for suffix in string.ascii_uppercase[:n]] fig = plt.figure(constrained_layout=True) ax = plt.gca() ax.set_xticks(np.arange(n)) ax.set_xticklabels(names) ax.set_yticks(np.arange(n)) ax.set_yticklabels(names) # Set ticks on both sides of axes on ax.tick_params(axis="x", bottom=True, top=True, labelbottom=True, labeltop=True) # Rotate and align bottom ticklabels plt.setp([tick.label1 for tick in ax.xaxis.get_major_ticks()], rotation=45, ha="right", va="center", rotation_mode="anchor") # Rotate and align top ticklabels plt.setp([tick.label2 for tick in ax.xaxis.get_major_ticks()], rotation=45, ha="left", va="center",rotation_mode="anchor") ax.set_title("Name Co-Occurrences") plt.show() Before After PR Checklist Has Pytest style unit tests Code is Flake 8 compliant New features are documented, with examples if plot related Documentation is sphinx and numpydoc compliant Added an entry to doc/users/next_whats_new/ if major new feature (follow instructions in README.rst there) Documented in doc/api/api_changes.rst if API changed in a backward-incompatible way
Open Graph Description: PR Summary Titles are supposed to avoid tick labels as of #9498. However, if ticks are labeled at the top and bottom of a plot, ax.xaxis.get_ticks_position() returns "unknown" instead o...
X Description: PR Summary Titles are supposed to avoid tick labels as of #9498. However, if ticks are labeled at the top and bottom of a plot, ax.xaxis.get_ticks_position() returns "unknown" i...
Opengraph URL: https://github.com/matplotlib/matplotlib/pull/13741
X: @github
Domain: github.com
| route-pattern | /:user_id/:repository/pull/:id/files(.:format) |
| route-controller | pull_requests |
| route-action | files |
| fetch-nonce | v2:06974941-969e-c3ce-7a48-ad706a94076a |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | 9436:23D81D:193E5FE:221F508:6A5363A4 |
| html-safe-nonce | b33c84a58c3f68bc6c032f936b467f0a59a59758d2c2c9515448a8d38a7bfc3e |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5NDM2OjIzRDgxRDoxOTNFNUZFOjIyMUY1MDg6NkE1MzYzQTQiLCJ2aXNpdG9yX2lkIjoiNzY5NDAyMDk3NzIzMjE0MzI2OCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 5b441927b421c7bb5b275d32fda836d78bb170bb95f3cd71e62a867786207cdb |
| hovercard-subject-tag | pull_request:263787981 |
| github-keyboard-shortcuts | repository,pull-request-list,pull-request-conversation,pull-request-files-changed,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/matplotlib/matplotlib/pull/13741/files |
| twitter:image | https://avatars.githubusercontent.com/u/1562854?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/1562854?s=400&v=4 |
| og:image:alt | PR Summary Titles are supposed to avoid tick labels as of #9498. However, if ticks are labeled at the top and bottom of a plot, ax.xaxis.get_ticks_position() returns "unknown" instead o... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | b9a586c06a05a7a86fc7e3f4dbd03e42f6869085879aa184aa6369456dbd50fb |
| turbo-cache-control | no-preview |
| diff-view | unified |
| 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 full-width |
| disable-turbo | true |
| 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