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
VIZ, ENH: allow show/hide annotations by label #8624
Conversation
@larsoner @hoechenberger @cbrnr One question I had when implementing this is: what should happen if someone toggles an annotation label to be invisible, but that label is still "selected", and then they click-drag on the plot to create a new annotation? Currently what happens is the span selector shows during dragging, but the new annotation disappears as soon as the mouse button is released. I don't think that's ideal, but the only alternative I could think of was for all annotations with that label to become visible when the mouse button is either pressed or released, either of which seem kinda weird from a UX point of view. Thoughts? |
I'd deselect it before hiding. It doesn't even have to be reselected when showing the type again. |
as soon as I had an annot of type A then all annots of this type become
visible.
that's how I would do it
… |
Great!!! Using the
|
@hoechenberger I don't know the details of how macOS's tiling works, but I wouldn't necessarily expect it to work smoothly, given that the figure is re-created each time a label is added. Anything you can tell me about it that might help figure out what is going wrong? The checkbox duplication and sizing is also weird; any ideas there? Regarding how to handle adding an annotation when its label's visibility is turned off: after some reflection I think I prefer @agramfort's suggested fix (automatically switch visibility to true for that label) rather than @cbrnr's suggestion (automatically de-activate a label when it's made invisible). The latter proposal forces us to handle a new situation: no annotations visible means no labels are selected (currently there is always one label selected), so we'd need to special-case what the SpanSelector should (not) do when no label is selected. Certainly possible, but I think "auto-make-visible" a label is easier to implement, and about equal in terms of user expectations of what should happen in that corner case. Ayone else want to weigh in? |
I can see the problem and I'm fine with @agramfort's suggestion. However, this means that at least one annotation type is always visible. I think it would be useful to hide all annotations, because sometimes annotations get in the way of the actual time series (especially in a data set with many different annotations). I don't know the best solution, but having a separate show/hide annotations would be one option (which is relatively independent from this PR). |
I see the problem and I'm fine with @agramfort
<https://github.com/agramfort>'s suggestion. However, this means that at
least one annotation type is always visible.
why? to me you make them all invisible. It's only when you add one that all
annot of this type become visible
|
Yes, this is what I had in mind. I'll move forward with that approach. |
@hoechenberger do you want to test it? |
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.
Code changes LGTM but it would be good if a heavy annotation user could test it out
@larsoner Yes I will have a look shortly. |
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 great for me!
This isn't working for me yet, not sure if it was supposed to :) |
working locally but I haven't pushed yet. Decided to see if I could also get |
ok, I didn't manage to get |
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.
Perfect! I love it
@drammock Can you add a changelog entry please? Otherwise, LGTM!! |
Thanks a bunch, @drammock! |
* upstream/master: (42 commits) MRG, ENH: Add DICS bias tests (mne-tools#8610) MRG, BUG, ENH: Add window option (mne-tools#8662) BUG: Fix alpha for volumes (mne-tools#8663) MRG, BUG: Fix bugs with envcorr (mne-tools#8658) MRG, ENH: Progressbar for csd_morlet (mne-tools#8608) Render is necessary now (mne-tools#8657) VIZ: Fix head size (mne-tools#8651) MRG, MAINT: bump sphinxcontrib-bitex version (mne-tools#8653) MRG, MAINT: Improve server env (mne-tools#8656) BUG: Mayavi center (mne-tools#8644) VIZ, ENH: allow show/hide annotations by label (mne-tools#8624) Add regression test for EEGLAB data with a chanlocs struct (mne-tools#8647) FIX: scalar_bar (mne-tools#8643) MRG: Small fix to tutorial; rename plot_events ordinate label to "Event id"; improve some SSP docstrings (mne-tools#8612) MRG, ENH: make plot alignment use defaults for colors (mne-tools#8553) BUG: Fix passing of channel type (mne-tools#8638) FIX: fixed loop over norm PSF/CTF options (mne-tools#8636) MRG, BUG: Pass kwargs (mne-tools#8630) DOC: Clearer error message (mne-tools#8631) BUG: Fix number of labels (mne-tools#8629) ...
* upstream/master: (38 commits) MRG, ENH: Add DICS bias tests (mne-tools#8610) MRG, BUG, ENH: Add window option (mne-tools#8662) BUG: Fix alpha for volumes (mne-tools#8663) MRG, BUG: Fix bugs with envcorr (mne-tools#8658) MRG, ENH: Progressbar for csd_morlet (mne-tools#8608) Render is necessary now (mne-tools#8657) VIZ: Fix head size (mne-tools#8651) MRG, MAINT: bump sphinxcontrib-bitex version (mne-tools#8653) MRG, MAINT: Improve server env (mne-tools#8656) BUG: Mayavi center (mne-tools#8644) VIZ, ENH: allow show/hide annotations by label (mne-tools#8624) Add regression test for EEGLAB data with a chanlocs struct (mne-tools#8647) FIX: scalar_bar (mne-tools#8643) MRG: Small fix to tutorial; rename plot_events ordinate label to "Event id"; improve some SSP docstrings (mne-tools#8612) MRG, ENH: make plot alignment use defaults for colors (mne-tools#8553) BUG: Fix passing of channel type (mne-tools#8638) FIX: fixed loop over norm PSF/CTF options (mne-tools#8636) MRG, BUG: Pass kwargs (mne-tools#8630) DOC: Clearer error message (mne-tools#8631) BUG: Fix number of labels (mne-tools#8629) ...
closes #8578