Skip to content

Conversation

@paracini
Copy link
Collaborator

  • Interactive plot commands. TO FIX: LogY toggle does not work due to workarounds used to handle plopp plots
  • R*Q^4 toggle. TO FIX: handling plopp required workarounds, there are probably better ways to implement this
  • individual datasets toggles to hide curves in plotting. TO FIX: error bars are not correctly handled and remain visible
  • 'Remove plot' button to remove appended plots. TO FIX: removing a plot also removes all the earlier plots in the
  • Added comment box above each plot for annotations

def log_progress(self, progress):
self.progress_log.children = (progress,)

def log_plot(self, plot):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we need to take a good look at the code in this function, see if we can do things differently, or in a more compact or efficient way.
There seem to be a lot of workarounds in here.

It would be nice to get an explanation, or a live demo, to see what features are needed.
At the moment, this is all very difficult to read and will be hard to maintain.

# Create unique ID for this plot group - currently unused
self.plot_counter += 1

# Convert any existing interactive plots to static
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need to convert interactive plots to static ones?

original_draw = plot.view.canvas.draw

# Define all helper functions first
def calculate_plot_limits(current_plot, is_transformed=False):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If possible, we should rely on plopp to do this for us.

Comment on lines 661 to 665
# Now override the methods
plot.view.canvas.reset_mode = custom_reset_mode
plot.view.canvas.zoom = custom_zoom
plot.view.canvas.panzoom = custom_panzoom
plot.view.canvas.draw = custom_draw
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Without having thought too much about it, this feels dangerous.

plot.view.canvas.draw = custom_draw

# Create and populate legend controls
def create_legend_controls():
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seem like more GUI features have crept it, and keeping everything in sync is becoming more and more difficult.

@paracini
Copy link
Collaborator Author

I agree, I wasn't sure whether to make the pull request at this point, maybe it's better to just do a demo and discuss. There are a lot of workarounds that complicate things at this stage

@jokasimr jokasimr mentioned this pull request Mar 3, 2025
Copy link
Member

@nvaytet nvaytet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking good now 👍

I would like to see some type-hints and docstrings (with Parameters) on all functions.

It would also be nice to have some unit tests of basic functionality, such as simply generating the gui, and loading a file and running if possible.

Comment on lines +201 to +211
Known limitations:
1. Remove plot button behavior is inconsistent:
- Removes the target plot with its controls
- Previous plots disappear but their control buttons remain
- Previous plots maintain interactivity despite attempted conversion to static
2. Dataset toggle does not affect error bars as they are separate matplotlib artists
3. Remove row button removes last row instead of selected row
4. LogY toggle doesn't work due to workarounds for plopp's axis behavior:
- Plopp's autoscale was flipping the y-axis orientation
- We override multiple plopp/matplotlib methods to maintain correct orientation
- This prevents the LogY toggle from working as it would interfere with our fixes
Copy link
Member

@nvaytet nvaytet Mar 27, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unless I am mistaken, I think we fixed all these with @jokasimr ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes these are all fixed!

@jokasimr jokasimr merged commit f58df1a into scipp:gui-experiment Mar 28, 2025
4 checks passed
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.

3 participants