question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Clarify the behaviour of the `events` parameter of Epochs.plot

See original GitHub issue

Describe the new feature or enhancement

Since version 0.22 the default behaviour when plotting epochs with Epochs.plot() is to not show the event labels and vertical bars at the top.

Maybe it would help newcomers and users used to the 0.21 behaviour to show how to do it in the tutorial?

Describe your proposed implementation

Replacing: epochs.plot(n_epochs=10) by epochs.plot(events=epochs.events, n_epochs=10) in plot_10_epochs_overview.py.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:6 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
drammockcommented, Feb 23, 2021

I just checked out the maint/0.21 branch and tried this “press O for options” … I don’t think I’d ever used it before, and it actually doesn’t work well at all (toggling visibility of various elements worked in the off direction but not when turning them back on, the sliders for adjusting n_channels/n_epochs both yielded IndexError…). So, what needs to be tackled (these could be separate PRs):

  1. either remove mention in docstring of “press O for options” (easy) or actually implement the options interface (hard)
  2. correct inaccurate docstring statement that epoch numbers are removed when event numbers are shown

I think actually not plotting events by default is the correct behavior, since by default events=None so I take back what I said earlier; this is not a regression but rather 0.21 was doing something it shouldn’t have 😃

1reaction
drammockcommented, Feb 23, 2021
  1. the color change was intentional, to make raw.plot() and epochs.plot() behave similarly and have similar defaults. The old coloring can still be achieved with event_color='g' or so.

  2. I checked and it seems like “by default the coloring scheme is the same” (between epochs.plot() and mne.viz.plot_events()) is still true (both use matplotlib default color cycle).

  3. The docstring does seem to be inaccurate; event numbers are above and epoch numbers below so I’m not sure what “overlap” was being avoided there.

  4. I hadn’t noticed this before, but the “press o for options” doesn’t work at all anymore.

Seems like this is a more complicated fix than it seemed at first.

Read more comments on GitHub >

github_iconTop Results From Across the Web

mne.Epochs — MNE 1.2.2 documentation
Reject epochs based on maximum peak-to-peak signal amplitude (PTP), i.e. the absolute difference between the lowest and the highest signal ...
Read more >
Define epochs according to event order - MNE Forum
and I want to create epochs that contain three events ('Hit': 2, ''M_Hit': 7, 'OGT': 8). All three events should be contained in...
Read more >
mne-python/epochs.py at main
logger.info('Multiple event values for single event times found. ' 'Keeping the first occurrence and dropping all others.') new_events = events ...
Read more >
Epochs - Mainak Jas
Epochs objects are a way of representing continuous data as a collection of time-locked trials, stored in an array of shape (n_events, n_channels,...
Read more >
models.word2vec – Word2vec embeddings — gensim
Set self.lifecycle_events = None to disable this behaviour. Calls to add_lifecycle_event() will not record events into self.lifecycle_events then. Parameters.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found