-
Notifications
You must be signed in to change notification settings - Fork 41
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add persistent legend visibility toggle #2266
Add persistent legend visibility toggle #2266
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've noted one issue that needs to be fixed in a separate comment here.
Not surprisingly, on redraw, the location of the legend resets to the original position, but that is likely beyond the scope of this PR. I'm going to create a plotting discussion (if there isn't one already) about this. Plots are completely reconstructed on redraw, resetting many attributes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Works also on Mac as long as plot window is not closed (which should be as it is) and except bug @krzywon pointed out.
Also looked at the other perspectives and it works for all except Corfunc, which has differemt plotting mechanism. The intention is to make it also available for Corfunc, however this is not something that will be done for this PR. |
Thanks @krzywon for the suggestion!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The most recent change fixes the issue I noted earlier.
As discussed in #2215, adds a new instance variable to
PlotterWidget
,self.legendVisible
which tracks the user's preference for having the legend visible/invisible (this is distinct fromself.showLegend
which tracks whether the plot has a legend at all). TheonToggleLegend
and similar methods are updated to toggleself.legendVisible
then trigger a redraw rather than just modifying the existing plot. Tested and appears to work on Win10.