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 UI Event linking to DraggableColorbar #12057

Merged
merged 19 commits into from
Oct 5, 2023
Merged

Conversation

ruuskas
Copy link
Contributor

@ruuskas ruuskas commented Oct 3, 2023

This change makes the DraggableColorbar class work with UI Events. Users can now link figures that contain topoplots or epoch/tfr images and manipulate the color scale and color map interactively.

Basic example based on the Using the event system to link figures tutorial.

import mne
from mne.viz.ui_events import link

# Turn on interactivity
plt.ion()
data_path = mne.datasets.sample.data_path()
evokeds_fname = data_path / "MEG" / "sample" / "sample_audvis-ave.fif"
evokeds = mne.read_evokeds(evokeds_fname)

left_auditory = evokeds[0]
right_auditory = evokeds[1]

fig1 = left_auditory.plot_topomap("interactive")
fig2 = right_auditory.plot_topomap("interactive")

link(fig1, fig2)

This change makes the DraggableColorbar class work with UI Events. Users
can now link figures that contain topoplots or epoch/tfr images and
manipulate the color scale and color map interactively.
Santeri Ruuskanen and others added 2 commits October 3, 2023 16:51
The full docstring includes info on the interactive functionality.
@larsoner
Copy link
Member

larsoner commented Oct 3, 2023

Ideally every change should have an updated test. Can you look to see if _fake_click can be used to trigger a change in the colorbar and emit your new UIEvent?

@larsoner
Copy link
Member

larsoner commented Oct 3, 2023

... also needs a doc/changes/devel.rst update to mention this enhancement

mne/viz/ui_events.py Outdated Show resolved Hide resolved
@wmvanvliet
Copy link
Contributor

CI failure "Test Windows 3.11 pip pre" is not releated to this PR

@drammock
Copy link
Member

drammock commented Oct 4, 2023

CI failure "Test Windows 3.11 pip pre" is not releated to this PR

agreed, @larsoner snuck a fix into #12064

Santeri Ruuskanen added 2 commits October 4, 2023 14:16
Colormaps now update across figures also after interacting with the time
 slider.
Copy link
Contributor

@wmvanvliet wmvanvliet left a comment

Choose a reason for hiding this comment

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

Looking great. Only a few nickpicks regarding kind

mne/viz/evoked.py Outdated Show resolved Hide resolved
mne/viz/topo.py Outdated Show resolved Hide resolved
@ruuskas
Copy link
Contributor Author

ruuskas commented Oct 5, 2023

@wmvanvliet Any idea why the CI doctest fails?

@wmvanvliet
Copy link
Contributor

seems unrelated. Let's try again with latest main merged in.

@ruuskas
Copy link
Contributor Author

ruuskas commented Oct 5, 2023

This should be good now @wmvanvliet

@wmvanvliet wmvanvliet merged commit cedefa0 into mne-tools:main Oct 5, 2023
28 checks passed
@wmvanvliet
Copy link
Contributor

Thanks @ruuskas!

larsoner added a commit to larsoner/mne-python that referenced this pull request Oct 10, 2023
* upstream/main: (37 commits)
  Use constrained layout in matplotlib visualization (mne-tools#12050)
  Add raw stc (mne-tools#12001)
  [MRG] update codeowners (mne-tools#12089)
  DOC: Morlet wavelet length in tfr_morlet (mne-tools#12073)
  BUG: Fix bug with mne browser backend (mne-tools#12078)
  Cache avatars (mne-tools#12077)
  BUG: Fix bug with ch_name resolution (mne-tools#12086)
  add unicode roundtrip for FIF (mne-tools#12080)
  add Ivan to names.inc (mne-tools#12081)
  MAINT: Work around PySide 6.5.3 event loop error (mne-tools#12076)
  mne-tools#11608, buggfix and docstring update (mne-tools#12066)
  MAINT: Fix broken examples (mne-tools#12074)
  Add UI Event linking to DraggableColorbar (mne-tools#12057)
  handle lazy loading through .pyi type stubs (mne-tools#12072)
  BUG: Fix bug with sensor_colors (mne-tools#12068)
  clean  up some deprecations (mne-tools#12067)
  Allow not dropping bads when creating or plotting Spectrum objs (mne-tools#12006)
  Collapsible html repr for raw/info (mne-tools#12064)
  BUG: Fix bug with pickling MNEBadsList (mne-tools#12063)
  add details for Denis (mne-tools#12065)
  ...
snwnde pushed a commit to snwnde/mne-python that referenced this pull request Mar 20, 2024
Co-authored-by: Santeri Ruuskanen <[email protected]>
Co-authored-by: Marijn van Vliet <[email protected]>
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.

4 participants