Title: FIX: fallback text renderer to fig._cachedRenderer, if none found by jklymak · Pull Request #12012 · matplotlib/matplotlib · GitHub
Open Graph Title: FIX: fallback text renderer to fig._cachedRenderer, if none found by jklymak · Pull Request #12012 · matplotlib/matplotlib
X Title: FIX: fallback text renderer to fig._cachedRenderer, if none found by jklymak · Pull Request #12012 · matplotlib/matplotlib
Description: PR Summary Closes #10874. See also #11004, and #10881. This is a more general backstop than the ticking fixes being proposed in #10874. If a text obejct is created, but never drawn, its renderer never gets set (self._renderer). Subsequnet calls to self.get_window_extent() that do not specify the renderer fail with RuntimeError('Cannot get window extent w/o renderer'). Here I propose that we fall back on the cached renderer for the figure. Test code: import matplotlib matplotlib.use('Agg') import matplotlib.pyplot as plt fig = plt.figure() ax = fig.add_subplot(111, frameon=True) ax.plot() plt.get_current_fig_manager().canvas.draw() for xtick in ax.get_xticklabels(): bb = xtick.get_window_extent() 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 Closes #10874. See also #11004, and #10881. This is a more general backstop than the ticking fixes being proposed in #10874. If a text obejct is created, but never drawn, its renderer ...
X Description: PR Summary Closes #10874. See also #11004, and #10881. This is a more general backstop than the ticking fixes being proposed in #10874. If a text obejct is created, but never drawn, its renderer ...
Opengraph URL: https://github.com/matplotlib/matplotlib/pull/12012
X: @github
Domain: github.com
| route-pattern | /:user_id/:repository/pull/:id/files(.:format) |
| route-controller | pull_requests |
| route-action | files |
| fetch-nonce | v2:558b9fef-2ad8-5181-069c-56f21e076156 |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | 9DD2:146E92:24A3DF0:351EA2E:6A566018 |
| html-safe-nonce | e9845442372be12beac16b4d9e77ae0ee315231b9eda95b65706e56bd9fa1917 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5REQyOjE0NkU5MjoyNEEzREYwOjM1MUVBMkU6NkE1NjYwMTgiLCJ2aXNpdG9yX2lkIjoiNjIyMzg5Mzk4MDYwNjQ2NjQiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 00dd2b68dd4d555356db0264808991c0c0316c5f27544960a7f0936059022c15 |
| hovercard-subject-tag | pull_request:213081147 |
| 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/12012/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 Closes #10874. See also #11004, and #10881. This is a more general backstop than the ticking fixes being proposed in #10874. If a text obejct is created, but never drawn, its renderer ... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | 6a3afe34dff341ad10912db44becf282289d7f2af20576241738530fbb28de01 |
| 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 |
| disable-turbo | true |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | b71002134df95575e9f6c2945a64d454b0be181e |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width