Skip to content

Conversation

@jaeilepp
Copy link
Contributor

@jaeilepp jaeilepp commented Jun 8, 2016

Closes #3005
Also:
closes #3063

if 'grad' in self:
types.append('grad')
chs = [ch for ch in self.ch_names if ch.startswith('MEG') and
ch.endswith(('2', '3'))]
Copy link
Member

Choose a reason for hiding this comment

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

this is neuromag specificity. Why is this needed?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Related to #3063
I'll fix it.

@jaeilepp jaeilepp changed the title Draggable colorbar. [WIP] Draggable colorbar. Jun 8, 2016
@kingjr
Copy link
Member

kingjr commented Jun 8, 2016

Thanks @jaeilepp for taking the time to do this !

From what I understand this would work for divergent colormaps.

Are you planning on addressing the sequential cases (e.g. combined gradiometers, potentially time frequency spectrum)?

In matplotlib they typically use one mouse button for displacement and another for scaling, so we could have a similar approach for clim WDYT?

@jaeilepp
Copy link
Contributor Author

jaeilepp commented Jun 8, 2016

Now the color map can be changed with up/down keys. Clicking and dragging changes the scale. Left mouse button moves it up and down and right mouse button changes the lims.
It was pretty straightforward to implement using the DraggableColorbar in http://www.ster.kuleuven.be/~pieterd/python/html/plotting/interactive_colorbar.html

@codecov-io
Copy link

codecov-io commented Jun 8, 2016

Current coverage is 86.67%

Merging #3290 into master will increase coverage by 0.20%

@@             master      #3290   diff @@
==========================================
  Files           335        335          
  Lines         57322      57625   +303   
  Methods           0          0          
  Messages          0          0          
  Branches       8715       8780    +65   
==========================================
+ Hits          49567      49947   +380   
+ Misses         5132       5003   -129   
- Partials       2623       2675    +52   

Sunburst

Powered by Codecov. Last updated by ea83b84...5bf1674

mne/viz/topo.py Outdated
cmap = 'RdBu_r'
interactive_cmap = True
else:
interactive_cmap = False
Copy link
Member

Choose a reason for hiding this comment

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

interactive_cmap = False
if cmap == 'interactive':
     cmap = 'RdBu_r'
     interactive_cmap = True

@kingjr
Copy link
Member

kingjr commented Jun 8, 2016

LGTM

@jaeilepp jaeilepp changed the title [WIP] Draggable colorbar. [MRG] Draggable colorbar. Jun 9, 2016
@jaeilepp
Copy link
Contributor Author

jaeilepp commented Jun 9, 2016

Now interactive mode works for tfr, images and topomaps. For topos it is probably too heavy. Ready for review.

@larsoner
Copy link
Member

Can you rebase? Then I'll try it and merge if it's all good


- Added the ability to decimate :class:`mne.Evoked` objects with :func:`mne.Evoked.decimate` by `Eric Larson`_

- Add 'cmap=interactive' option to plotting functions by `Jaakko Leppakangas`_
Copy link
Member

Choose a reason for hiding this comment

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

double-backticks on the quote will read nicer, and interactive should probably be a string in that code bit

@larsoner
Copy link
Member

Can you mention quickly the examples you've been running to test this to save reviewers some git grep calls?

@jaeilepp
Copy link
Contributor Author

Can you mention quickly the examples you've been running to test this to save reviewers some git grep calls?

I've had my own scripts for testing, but it works for tfr, topomap and image. So plot_evoked_topomap, plot_channel_epochs_image.py, plot_time_frequency_simulated.py

@larsoner
Copy link
Member

Does plot_evoked_topomap work for you? It seems really slow for me

@larsoner
Copy link
Member

For topos it is probably too heavy.

I think we should probably remove the option if it isn't really usable. At the very least we should add a .. warning:: that it's likely very slow.

@larsoner
Copy link
Member

Works nicely in plot_visualize_evoked.py using a evoked_r_aud.plot_image(picks=picks, cmap='interactive') call. I expected the scroll wheel to do the same thing as the right-click-drag, namely "zoom" the colorbar. WDYT?

@jaeilepp
Copy link
Contributor Author

Does plot_evoked_topomap work for you? It seems really slow for me

Yeah, it's quite slow. I'll investigate.

I think we should probably remove the option if it isn't really usable. At the very least we should add a .. warning:: that it's likely very slow.

It's not enabled for topographies

@jaeilepp
Copy link
Contributor Author

Works nicely in plot_visualize_evoked.py using a evoked_r_aud.plot_image(picks=picks, cmap='interactive') call. I expected the scroll wheel to do the same thing as the right-click-drag, namely "zoom" the colorbar. WDYT?

Yeah, why not.

@larsoner
Copy link
Member

It's not enabled for topographies

Sorry, I meant for topomap plots even, if we can't make them fast enough to actually use.

@jaeilepp
Copy link
Contributor Author

Now cmap is accepted as tuple, where the second element defines the interacitivity. It is also on by default except with topomaps when there are more than two of them.

@larsoner
Copy link
Member

LGTM and the interaction is nice in e.g. plot_channel_epochs_image.py. +1 for merge from me.

If someone else has you make changes, it might be nice to add cmap='interactive' in that example or some other one.

@larsoner larsoner changed the title [MRG] Draggable colorbar. [MRG+1] Draggable colorbar. Jun 28, 2016
@dengemann
Copy link
Member

Very nice! Indeed. +1 for showing this in one example or even a gif to be tweeted cc @kingjr

@jaeilepp
Copy link
Contributor Author

If someone else has you make changes, it might be nice to add cmap='interactive' in that example or some other one.

That's basically the default behavior now, but I'll add it somewhere since I'm adding a test anyway.

@agramfort
Copy link
Member

@jaeilepp can you just update the viz tutorial(s) to document this?

then +1 for merge

@agramfort
Copy link
Member

you can add a section of changing the colormap eg in the epochs viz tutorial

@jaeilepp
Copy link
Contributor Author

Ready for review/merge.

@larsoner larsoner merged commit a3ed105 into mne-tools:master Jun 29, 2016
@larsoner
Copy link
Member

Thanks @jaeilepp

@jaeilepp jaeilepp deleted the draggable-cmap branch June 30, 2016 05:20
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.

topo interactivity broken on evoked.plot() ENH: interactive colorscale

8 participants