Skip to content

MAINT: Clone more legend settings in Qt figure options#32014

Closed
jhkr1 wants to merge 2 commits into
matplotlib:mainfrom
jhkr1:fix-qt-legend-clone
Closed

MAINT: Clone more legend settings in Qt figure options#32014
jhkr1 wants to merge 2 commits into
matplotlib:mainfrom
jhkr1:fix-qt-legend-clone

Conversation

@jhkr1

@jhkr1 jhkr1 commented Jul 8, 2026

Copy link
Copy Markdown

PR summary

Closes #17775

When regenerating the legend in the Qt figure options dialog, the code currently only preserves the ncols and draggable properties. Any other custom settings the user might have configured on the legend (like title, location, or frame styling) are completely discarded and reset to defaults when clicking "Apply".

This PR fixes this by extracting additional useful properties (like title, loc, frameon, shadow, edgecolor, facecolor, and framealpha) from the old legend and passing them to the new legend, ensuring that user configurations are preserved.

AI Disclosure

I wrote and structured the PR myself, relying on the documentation and the internal attributes of the Legend class.

PR checklist

  • "closes clone more legend settings when regenerating in Qt figure options dialog #17775" is in the body of the PR description to link the related issue
  • [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

@github-actions

github-actions Bot commented Jul 8, 2026

Copy link
Copy Markdown

Thank you for opening your first PR into Matplotlib!

If you have not heard from us in a week or so, please leave a new comment below and that should bring it to our attention. Most of our reviewers are volunteers and sometimes things fall through the cracks. We also ask that you please finish addressing any review comments on this PR and wait for it to be merged (or closed) before opening a new one, as it can be a valuable learning experience to go through the review process.

You can also join us on discourse chat for real-time discussion.

For details on testing, writing docs, and our review process, please see the developer guide.
Please let us know if (and how) you use AI, it will help us give you better feedback on your PR.

We strive to be a welcoming and open project. Please follow our Code of Conduct.

@scottshambaugh

Copy link
Copy Markdown
Contributor

It looks like you opened this PR twice, I'll leave #32015 open and close this one. In the future feel free to edit the existing PR rather than making a new one

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

clone more legend settings when regenerating in Qt figure options dialog

2 participants