Title: [MNT]: new public method to help title positioning · Issue #29385 · matplotlib/matplotlib · GitHub
Open Graph Title: [MNT]: new public method to help title positioning · Issue #29385 · matplotlib/matplotlib
X Title: [MNT]: new public method to help title positioning · Issue #29385 · matplotlib/matplotlib
Description: Summary The change that broke #29381 would have been fine if the logic that calculates top within Axes._update_title_position only needed to work for ordinary Axes instances. Cartopy has artists separate from the XAxis and YAxis which mu...
Open Graph Description: Summary The change that broke #29381 would have been fine if the logic that calculates top within Axes._update_title_position only needed to work for ordinary Axes instances. Cartopy has artists se...
X Description: Summary The change that broke #29381 would have been fine if the logic that calculates top within Axes._update_title_position only needed to work for ordinary Axes instances. Cartopy has artists se...
Opengraph URL: https://github.com/matplotlib/matplotlib/issues/29385
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"[MNT]: new public method to help title positioning","articleBody":"### Summary\r\n\r\n1. The change that broke #29381 would have been fine if the [logic that calculates `top` within `Axes._update_title_position`](https://github.com/matplotlib/matplotlib/blob/c11175d142403ff9af6e55ccb1feabccb990a7f6/lib/matplotlib/axes/_base.py#L3068-L3090) only needed to work for ordinary `Axes` instances.\r\n2. Cartopy has artists separate from the `XAxis` and `YAxis` which must be considered for title placement. Currently, it does that by [overriding `_update_title_position`](https://github.com/SciTools/cartopy/blob/113be8ee587a6a57e20a5cc46bb27247b8f31fea/lib/cartopy/mpl/geoaxes.py#L511). Overriding a private method is not ideal, neither is repeating some of the code that is already in the parent method.\r\n\r\n### Proposed fix\r\n\r\nFactor out a public method that returns `top`. Making it public means it can safely be overridden in subclasses such as `PolarAxes` and Cartopy's `GeoAxes`. Knowing it can/should be overridden in subclasses means that in the parent `Axes` we can use the most efficient approach that works for `Axes`.","author":{"url":"https://github.com/rcomer","@type":"Person","name":"rcomer"},"datePublished":"2024-12-29T15:06:57.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":3},"url":"https://github.com/29385/matplotlib/issues/29385"}
| 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:4e05cd57-1de0-7dbd-7abe-dc5f17c18d06 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | A3AE:12915F:E71923:133EC77:6A51B950 |
| html-safe-nonce | eca37c74f3882091f5bf8f60a50c75d917e4865628223c7e915e6afc73e2ff55 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBM0FFOjEyOTE1RjpFNzE5MjM6MTMzRUM3Nzo2QTUxQjk1MCIsInZpc2l0b3JfaWQiOiIxODk3MTI3NzY0MTI2OTcyMjQxIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | e81445552da2cda3b35a52a302aacdee4cb7b71868c66c9f6b340b73ebb3cf21 |
| hovercard-subject-tag | issue:2762288711 |
| 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/29385/issue_layout |
| twitter:image | https://opengraph.githubassets.com/510ce287c7c8aaf4391027fb1185c646ee8d5eb6e5854133521fe2478ae93692/matplotlib/matplotlib/issues/29385 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/510ce287c7c8aaf4391027fb1185c646ee8d5eb6e5854133521fe2478ae93692/matplotlib/matplotlib/issues/29385 |
| og:image:alt | Summary The change that broke #29381 would have been fine if the logic that calculates top within Axes._update_title_position only needed to work for ordinary Axes instances. Cartopy has artists se... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | rcomer |
| 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 | 7aed05249554b889eb33d002851a973eebcc7e91 |
| ui-target | canary-2 |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width