Skip to content

Conversation

@drammock
Copy link
Member

@drammock drammock commented Dec 7, 2019

as discussed in #7111, this adds an event_id parameter to epochs.plot() so that if users are passing in events that aren't part of epochs.events, they can specify event colors by name instead of by integer.

It also allows user-specified event colors for the t=0 event to override the (default) transparent green vertical line at t=0. On this PR:

catch_trials_and_buttonpresses = mne.pick_events(events, include=[5, 32])
epochs['face'].plot(events=catch_trials_and_buttonpresses, event_id=event_dict,
                    event_colors=dict(buttonpress='red', face='blue'))

yields this:

this_PR

If no events are specified, or if the events passed to plot() don't include the event at t=0, the default line is still drawn (though it's been moved to zorder=0 to lie behind the traces instead of on top of them):

buttonpresses_only = mne.pick_events(events, include=[32])
epochs['face'].plot(events=buttonpresses_only, event_id=event_dict,
                    event_colors=dict(buttonpress='red'))

this_PR_2

Copy link
Member

@agramfort agramfort left a comment

Choose a reason for hiding this comment

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

+1 for MRG provided CIs are green. Add a what's new entry before merging plz

thx

@codecov
Copy link

codecov bot commented Dec 8, 2019

Codecov Report

Merging #7126 into master will increase coverage by 0.25%.
The diff coverage is 91.66%.

@@            Coverage Diff             @@
##           master    #7126      +/-   ##
==========================================
+ Coverage   89.48%   89.73%   +0.25%     
==========================================
  Files         444      444              
  Lines       79002    79138     +136     
  Branches    12678    12692      +14     
==========================================
+ Hits        70696    71017     +321     
+ Misses       5456     5314     -142     
+ Partials     2850     2807      -43

drammock and others added 2 commits December 8, 2019 15:54
mention versionadded

Co-Authored-By: Eric Larson <larson.eric.d@gmail.com>
@drammock drammock merged commit 9a7b5e5 into mne-tools:master Dec 9, 2019
@drammock drammock deleted the add-event-dict-to-epochs-plot-signature branch December 9, 2019 01:22
AdoNunes pushed a commit to AdoNunes/mne-python that referenced this pull request Apr 6, 2020
* add event_id dict to epochs.plot() signature

* update tutorial to test it

* add tutorial explanation

* event line at t=0 (possibly w/ user-specified color) overrides green t=0 line

* update what's new

* Update mne/viz/epochs.py

mention versionadded

Co-Authored-By: Eric Larson <larson.eric.d@gmail.com>
AdoNunes pushed a commit to AdoNunes/mne-python that referenced this pull request Apr 6, 2020
* add event_id dict to epochs.plot() signature

* update tutorial to test it

* add tutorial explanation

* event line at t=0 (possibly w/ user-specified color) overrides green t=0 line

* update what's new

* Update mne/viz/epochs.py

mention versionadded

Co-Authored-By: Eric Larson <larson.eric.d@gmail.com>
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