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

Zoom to rectangle in raw.plot #7006

Open
cbrnr opened this issue Oct 31, 2019 · 6 comments
Open

Zoom to rectangle in raw.plot #7006

cbrnr opened this issue Oct 31, 2019 · 6 comments

Comments

@cbrnr
Copy link
Contributor

cbrnr commented Oct 31, 2019

The raw.plot browser lacks a tool to zoom into a portion of the signal using the mouse. Would this be a useful feature? I'm willing to work on it (because I need it), but this will probably take some time to implement. Do you have suggestions on the UX? Maybe just trigger the action if the user drags the mouse (visual feedback in the form of a rectangle would be nice though)? Is there something similar already somewhere in MNE?

@agramfort
Copy link
Member

agramfort commented Oct 31, 2019 via email

@cbrnr
Copy link
Contributor Author

cbrnr commented Oct 31, 2019

Yes, at least page duration. I know I can do it with keyboard shortcuts, but it would be faster if I could just drag the portion of the signal I'd like to zoom in with the mouse.

Zooming on the y-axis like that would also be nice, but I guess this won't be that easy/intuitive because of the way we currently display the individual channels.

@agramfort
Copy link
Member

agramfort commented Oct 31, 2019 via email

@UnResolvedExpression
Copy link

Hello @cbrnr. Were you able to get this to work as you wished? I noticed on this page (https://mne.tools/stable/auto_tutorials/raw/40_visualize_raw.html) it is still suggesting to use hotkeys. I am interested in attempting to implement this myself and contributing to mne. Would you please advise on any potential challenges in this endeavor?

@cbrnr
Copy link
Contributor Author

cbrnr commented Jan 9, 2023

This would be great @UnResolvedExpression! I think the main steps for implementing zoom to rectangle are:

  1. Implement a new mode that can be toggled with a keyboard shortcut.
  2. When that mode is active, the mouse cursor should change to indicate that users can now drag a rectangle.
  3. After releasing the mouse button, get the left and right coordinates and set the visible signal to these limits.

One challenge for this feature is, I think, that is needs to work with both Matplotlib and Qt (PyQtGraph) backends. However, something similar is already implemented for marking annotations. You could take a look at how it's done and re-use parts of that implementation.

Finally, when we have zoom to rectangle, I think a "reset zoom" option would be very useful. This could e.g. always reset the visualization to show the first 10 seconds of data.

@shivzz-creator
Copy link

Yes, a zoom feature would be a very useful feature in the raw.plot browser.

We suggest a double click mouse action to trigger the zoom, as this is already a widely accepted way to quickly zoom in/out on images and documents. Additionally, a feedback of the zoom could be presented in real time, such as a growing (or shrinking) black rectangle around the area that is being zoomed in.

We are not aware of any similar feature already in MNE, but a similar feature is offered in more general EEG viewers, such as EEGLAB, BrainVision Analyzer and BIOSEMI ActiveTwo. As with those viewers, the user should be offered the ability to stay in the zoomed view, browse to other locations and then return to the original view.

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

No branches or pull requests

5 participants