Title: More strict handling of legend(labels) · Issue #18107 · matplotlib/matplotlib · GitHub
Open Graph Title: More strict handling of legend(labels) · Issue #18107 · matplotlib/matplotlib
X Title: More strict handling of legend(labels) · Issue #18107 · matplotlib/matplotlib
Description: We already discourage legend(labels) in the docs: Note: This way of using is discouraged, because the relation between plot elements and labels is only implicit by their order and can easily be mixed up. Additionally, this API is very pe...
Open Graph Description: We already discourage legend(labels) in the docs: Note: This way of using is discouraged, because the relation between plot elements and labels is only implicit by their order and can easily be mix...
X Description: We already discourage legend(labels) in the docs: Note: This way of using is discouraged, because the relation between plot elements and labels is only implicit by their order and can easily be mix...
Opengraph URL: https://github.com/matplotlib/matplotlib/issues/18107
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"More strict handling of legend(labels)","articleBody":"We already discourage `legend(labels)` in the docs:\r\n\r\n\u003e Note: This way of using is discouraged, because the relation between plot elements and labels is only implicit by their order and can easily be mixed up.\r\n\r\nAdditionally, this API is very permissive:\r\n- If there are less labels than artists, only the first `len(labels)` artists are labelled.\r\n- If there are more labels than artists, additional labels are silently ignored.\r\n\r\nIMHO this length adaption is very prone to hiding errors.\r\n\r\nPossible options if the number of labels does not match the number of available handles:\r\n\r\n1. Emit a warning.\r\n2. Deprecate the length adaption and error out in the future.\r\n3. Deprecate the whole `legend(labels)` API, because it's prone to misuse anyway. (This would us also enable in the long run to migrate to an explicit `legend(handles=None, labels=None, **kwargs)` signature instead of `legend(*args, **kwargs)`.)\r\n\r\nI tend to go with option 2. Comments are welcome.\r\n\r\nInspired by #18096.","author":{"url":"https://github.com/timhoffm","@type":"Person","name":"timhoffm"},"datePublished":"2020-07-28T23:55:41.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":4},"url":"https://github.com/18107/matplotlib/issues/18107"}
| 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:f5e6fe86-244f-9854-79ae-2a145101c4df |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 9550:A6E9E:21F85C8:2D7F441:6A5469CD |
| html-safe-nonce | 12bf4dd5bfcdcf94706ec343b8aed4ad3eb37e2ea8e74d53e6973f2bd1854896 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5NTUwOkE2RTlFOjIxRjg1Qzg6MkQ3RjQ0MTo2QTU0NjlDRCIsInZpc2l0b3JfaWQiOiI4NzQ5MTY1OTY5NjczMDM2MjkiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | b2fd3eb8be44dcca5d2382e094ce3ad618aff4220270ac8e67688664f9351018 |
| hovercard-subject-tag | issue:667452931 |
| 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/18107/issue_layout |
| twitter:image | https://opengraph.githubassets.com/4673c19dbe1011863697876051d6925489d3c03295af9af411beb1836d2a1d48/matplotlib/matplotlib/issues/18107 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/4673c19dbe1011863697876051d6925489d3c03295af9af411beb1836d2a1d48/matplotlib/matplotlib/issues/18107 |
| og:image:alt | We already discourage legend(labels) in the docs: Note: This way of using is discouraged, because the relation between plot elements and labels is only implicit by their order and can easily be mix... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | timhoffm |
| 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 | 6d28624802c2f7d9500239dd6870ed7031b7353b |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width