Skip to content
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

Merged
merged 2 commits into from
Oct 25, 2022

Conversation

pbeaucage
Copy link
Contributor

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 from self.showLegend which tracks whether the plot has a legend at all). The onToggleLegend and similar methods are updated to toggle self.legendVisible then trigger a redraw rather than just modifying the existing plot. Tested and appears to work on Win10.

Copy link
Contributor

@krzywon krzywon left a 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.

src/sas/qtgui/Plotting/Plotter.py Outdated Show resolved Hide resolved
@wpotrzebowski wpotrzebowski self-requested a review October 25, 2022 14:56
Copy link
Contributor

@wpotrzebowski wpotrzebowski left a 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.

@wpotrzebowski
Copy link
Contributor

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.

Copy link
Contributor

@krzywon krzywon left a 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.

@butlerpd butlerpd merged commit 5609ff0 into main Oct 25, 2022
@krzywon krzywon deleted the 2215-plot-legend-enabledisable-does-not-persist branch October 26, 2022 12:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Plot legend enable/disable does not persist between plot draws (e.g. fit runs)
4 participants