Title: ENH/MAINT: Improve legend handling in Qt figure options dialog by jhkr1 · Pull Request #32015 · matplotlib/matplotlib · GitHub
Open Graph Title: ENH/MAINT: Improve legend handling in Qt figure options dialog by jhkr1 · Pull Request #32015 · matplotlib/matplotlib
X Title: ENH/MAINT: Improve legend handling in Qt figure options dialog by jhkr1 · Pull Request #32015 · matplotlib/matplotlib
Description: Closes #17775 Closes #11109 PR summary This PR addresses two related issues in the Qt figure options dialog, both concerning legend handling in lib/matplotlib/backends/qt_editor/figureoptions.py. Problem 1 (#17775): Legend settings are lost when regenerating When a user clicks "Re-generate automatic legend" in the figure options dialog, the code previously only restored ncols and draggable. Any other settings the user had configured — such as the legend title, position, frame style, shadow, or transparency — were silently discarded and reset to their defaults. Fix: Before regenerating, the existing legend's properties are captured and passed to axes.legend() as keyword arguments: loc — legend position title — legend title text frameon — whether to show the frame shadow — whether to draw a shadow edgecolor, facecolor, framealpha — frame appearance Problem 2 (#11109): No way to hide the legend from the options dialog There was no way to toggle legend visibility in the figure options dialog without fully deleting the legend. This was inconvenient when a legend obscured part of the plot. Fix: A "Show legend" checkbox is added to the Axes tab. Its initial state reflects the current visibility of the legend. When unchecked, the legend is hidden (but not deleted), and it can be shown again by re-checking the box. AI Disclosure I used an AI assistant to help navigate the codebase and understand the structure of figureoptions.py. The implementation logic and final code were verified and understood by me before submission. PR checklist "closes #17775" and "closes #11109" are in the body of the PR description [N/A] new and changed code is tested [N/A] Plotting related features are demonstrated in an example [N/A] New Features and API Changes are noted with a directive and release note [N/A] Documentation complies with general and docstring guidelines
Open Graph Description: Closes #17775 Closes #11109 PR summary This PR addresses two related issues in the Qt figure options dialog, both concerning legend handling in lib/matplotlib/backends/qt_editor/figureoptions.py. P...
X Description: Closes #17775 Closes #11109 PR summary This PR addresses two related issues in the Qt figure options dialog, both concerning legend handling in lib/matplotlib/backends/qt_editor/figureoptions.py. P...
Opengraph URL: https://github.com/matplotlib/matplotlib/pull/32015
X: @github
Domain: github.com
| route-pattern | /:user_id/:repository/pull/:id/files(.:format) |
| route-controller | pull_requests |
| route-action | files |
| fetch-nonce | v2:3233798a-f817-843e-61e7-305074753a1e |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | 937A:29681E:C9D8D:10FA7C:6A53D5C3 |
| html-safe-nonce | 45a19c775c25d8480d9611596909be1c62d9aec3ecf5364f529f1cba370314f9 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5MzdBOjI5NjgxRTpDOUQ4RDoxMEZBN0M6NkE1M0Q1QzMiLCJ2aXNpdG9yX2lkIjoiOTIwMTQ1OTE3OTkxODk3MjM1NSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 2252a6359f8f21cadd3a908d7e8d2b1f7510c53bf90c11ea313dd8b823f932da |
| hovercard-subject-tag | pull_request:4010854355 |
| 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/32015/files |
| twitter:image | https://avatars.githubusercontent.com/u/110290060?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/110290060?s=400&v=4 |
| og:image:alt | Closes #17775 Closes #11109 PR summary This PR addresses two related issues in the Qt figure options dialog, both concerning legend handling in lib/matplotlib/backends/qt_editor/figureoptions.py. P... |
| 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 |
| 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