Title: FIX: return proper legend window extent by jklymak · Pull Request #10910 · matplotlib/matplotlib · GitHub
Open Graph Title: FIX: return proper legend window extent by jklymak · Pull Request #10910 · matplotlib/matplotlib
X Title: FIX: return proper legend window extent by jklymak · Pull Request #10910 · matplotlib/matplotlib
Description: PR Summary As per #10844, it was not possible to properly use text.OffsetFrom if the artist was a legend. The issue was that legend.get_window_extent was calling the wrong patch object to get the patch location. The following code now returns properly placed text regardless of the savefig dpi: import matplotlib.pyplot as plt import matplotlib.text fig, ax = plt.subplots(dpi=200, figsize=(3,3)) ax.plot(range(10), label='Bah') ax.set_xticks([]) ax.set_yticks([]) legend = ax.legend(loc="upper right") offset = matplotlib.text.OffsetFrom(legend, (1.0, 0.0)) ax.annotate("info_string", xy=(0,0),size=14, xycoords='figure fraction', xytext=(0, 0), textcoords=offset, horizontalalignment='right', verticalalignment='top') fig.savefig('plot1.png', dpi=100) PR Checklist Has Pytest style unit tests Code is PEP 8 compliant
Open Graph Description: PR Summary As per #10844, it was not possible to properly use text.OffsetFrom if the artist was a legend. The issue was that legend.get_window_extent was calling the wrong patch object to get the ...
X Description: PR Summary As per #10844, it was not possible to properly use text.OffsetFrom if the artist was a legend. The issue was that legend.get_window_extent was calling the wrong patch object to get the ...
Opengraph URL: https://github.com/matplotlib/matplotlib/pull/10910
X: @github
Domain: github.com
| route-pattern | /:user_id/:repository/pull/:id/files(.:format) |
| route-controller | pull_requests |
| route-action | files |
| fetch-nonce | v2:a195587b-c995-f6c0-b8d1-160b7f955956 |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | B64E:1749AA:177EF3:1F3C50:6A56F663 |
| html-safe-nonce | ea4ecdcab324b5b2fe3d94f82869b8680e667216b7785cf62f6ab60da47f759d |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCNjRFOjE3NDlBQToxNzdFRjM6MUYzQzUwOjZBNTZGNjYzIiwidmlzaXRvcl9pZCI6IjM1NTQ5Mjc4NjI2OTk0NTYxMDAiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 2655613b029fb632cb369f7d9ebd79aadcd5e64f1cde5dfcf7bc90276caf66df |
| hovercard-subject-tag | pull_request:178117153 |
| 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/10910/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 As per #10844, it was not possible to properly use text.OffsetFrom if the artist was a legend. The issue was that legend.get_window_extent was calling the wrong patch object to get the ... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | 4eb29e5f807bd95e41196adfbc6d28f9af12d89830d8b684f3e871774ddff2fc |
| 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 | b056788a129fb0194b61f2ebb4c43f6a9f4dfd27 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width