Title: FIX: behaviour of legend labels with leading underscores did not adhere to the API documentation by Klayto-235 · Pull Request #24713 · matplotlib/matplotlib · GitHub
Open Graph Title: FIX: behaviour of legend labels with leading underscores did not adhere to the API documentation by Klayto-235 · Pull Request #24713 · matplotlib/matplotlib
X Title: FIX: behaviour of legend labels with leading underscores did not adhere to the API documentation by Klayto-235 · Pull Request #24713 · matplotlib/matplotlib
Description: PR Summary This PR fixes an inconsistency between API documentation and actual behaviour. As per the documentation, when matplotlib.axes.Axes.legend or matplotlib.figure.Figure.legend is called without any arguments, artists whose labels begin with an underscore are not included in the legend. This is stated for the first of four ways to invoke the method, however, it currently applies to all four. This fix changes the current behaviour of legend-related API to adhere to the documentation, only filtering labels with leading underscores when using the first way of invoking the method (Automatic detection of elements to be shown in the legend), allowing the user to include labels with leading underscores by passing them to the legend method explicitly - using one of the remaining three options (note that in two of these, the user passes an iterable of labels, and in the remaining one, the user only explicitly passes the artist handles, not the labels). Furthermore, this feature (exclusion of labels with leading underscores) is only documented in the two methods mentioned above, not in the matplotlib.legend.Legend class itself, where it was partly implemented prior to this PR (probably an artefact due to earlier developments). PR Checklist Documentation and Tests Has pytest style unit tests (and pytest passes) Documentation is sphinx and numpydoc compliant (the docs should build without error). [N/A] New plotting related features are documented with examples. Release Notes [N/A] New features are marked with a .. versionadded:: directive in the docstring and documented in doc/users/next_whats_new/ [N/A] API changes are marked with a .. versionchanged:: directive in the docstring and documented in doc/api/next_api_changes/ [N/A] Release notes conform with instructions in next_whats_new/README.rst or next_api_changes/README.rst
Open Graph Description: PR Summary This PR fixes an inconsistency between API documentation and actual behaviour. As per the documentation, when matplotlib.axes.Axes.legend or matplotlib.figure.Figure.legend is called wit...
X Description: PR Summary This PR fixes an inconsistency between API documentation and actual behaviour. As per the documentation, when matplotlib.axes.Axes.legend or matplotlib.figure.Figure.legend is called wit...
Opengraph URL: https://github.com/matplotlib/matplotlib/pull/24713
X: @github
Domain: github.com
| route-pattern | /:user_id/:repository/pull/:id/files(.:format) |
| route-controller | pull_requests |
| route-action | files |
| fetch-nonce | v2:26d89d54-3d29-6766-55b5-9ce63ce8b644 |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | BDC2:23DDAB:EAF06A:1399B1C:6A54411F |
| html-safe-nonce | fee1618d8d65cae42e20d03e1f3a52554d6e26eafa2dde77644e388471dd36d2 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCREMyOjIzRERBQjpFQUYwNkE6MTM5OUIxQzo2QTU0NDExRiIsInZpc2l0b3JfaWQiOiI2MDUxNjQxOTI4NjcxNTc2MzUyIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 37db371b4cee8375cd53a428a4f968f3fb393b8993e5ba86465ca41fb870dbe8 |
| hovercard-subject-tag | pull_request:1163273299 |
| 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/24713/files |
| twitter:image | https://avatars.githubusercontent.com/u/73715842?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/73715842?s=400&v=4 |
| og:image:alt | PR Summary This PR fixes an inconsistency between API documentation and actual behaviour. As per the documentation, when matplotlib.axes.Axes.legend or matplotlib.figure.Figure.legend is called wit... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | b9a586c06a05a7a86fc7e3f4dbd03e42f6869085879aa184aa6369456dbd50fb |
| 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 | 07a982c1d40157c619b364352b704c3ce66bb332 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width