Title: Legend with "loc=best" does not try to avoid text · Issue #23323 · matplotlib/matplotlib · GitHub
Open Graph Title: Legend with "loc=best" does not try to avoid text · Issue #23323 · matplotlib/matplotlib
X Title: Legend with "loc=best" does not try to avoid text · Issue #23323 · matplotlib/matplotlib
Description: I had this issue, and found almost exactly the same problem on Stack Overflow (link) Briefly, the pyplot.legend does not try to avoid pyplot.text. Here is a minimal example: import matplotlib.pyplot as plt x = [1, 2] plt.plot(x, x, label...
Open Graph Description: I had this issue, and found almost exactly the same problem on Stack Overflow (link) Briefly, the pyplot.legend does not try to avoid pyplot.text. Here is a minimal example: import matplotlib.pyplo...
X Description: I had this issue, and found almost exactly the same problem on Stack Overflow (link) Briefly, the pyplot.legend does not try to avoid pyplot.text. Here is a minimal example: import matplotlib.pyplo...
Opengraph URL: https://github.com/matplotlib/matplotlib/issues/23323
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Legend with \"loc=best\" does not try to avoid text","articleBody":"I had this issue, and found almost exactly the same problem on Stack Overflow ([link](https://stackoverflow.com/questions/70656115/best-location-for-legend-is-covering-text)) \r\n\r\nBriefly, the pyplot.legend does not try to avoid pyplot.text. Here is a minimal example: \r\n```\r\nimport matplotlib.pyplot as plt\r\nx = [1, 2]\r\nplt.plot(x, x, label='plot name')\r\nplt.gca().text(0.05, 0.95, 'some text', transform=plt.gca().transAxes, verticalalignment='top')\r\nplt.gca().legend(loc='best')\r\nplt.show()\r\n```\r\n\r\nresulting in legend overlaying the text like this:\r\n\r\n\r\nBTW, my matplotlib version is 3.4.3","author":{"url":"https://github.com/ym3141","@type":"Person","name":"ym3141"},"datePublished":"2022-06-22T10:44:10.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":3},"url":"https://github.com/23323/matplotlib/issues/23323"}
| 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:ce084493-1bf0-093c-f020-773865b31f54 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | DBA4:2F0FE8:BBADDC:F7DC61:6A5321C2 |
| html-safe-nonce | 4328dc7880a8d4b5d53a19e60840f60fddc6063be426fc801dc29c51b861a58e |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEQkE0OjJGMEZFODpCQkFEREM6RjdEQzYxOjZBNTMyMUMyIiwidmlzaXRvcl9pZCI6Ijc3MjE3NTMwNzg1NTEyMjQ3NzAiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 61a8551b07a6e3def532b3cc19536aed4aac885404ab189f2d0a8bdb8d509432 |
| hovercard-subject-tag | issue:1279940906 |
| 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/23323/issue_layout |
| twitter:image | https://opengraph.githubassets.com/03f126e54bed702f5158d866b80f98e4bff79e73e37a20178cdd912d3174e3c4/matplotlib/matplotlib/issues/23323 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/03f126e54bed702f5158d866b80f98e4bff79e73e37a20178cdd912d3174e3c4/matplotlib/matplotlib/issues/23323 |
| og:image:alt | I had this issue, and found almost exactly the same problem on Stack Overflow (link) Briefly, the pyplot.legend does not try to avoid pyplot.text. Here is a minimal example: import matplotlib.pyplo... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | ym3141 |
| 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