# Show extra events in epochs plot

**URL:** <https://mne.discourse.group/t/show-extra-events-in-epochs-plot/6334>\
**Category:** Support & Discussions\
**Tags:** visualization, evoked, epochs\
**Created:** [February 13, 2023, 8:10am UTC](https://mne.discourse.group/t/show-extra-events-in-epochs-plot/6334 "2023-02-13T08:10:39Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![cbrnr](https://yyz2.discourse-cdn.com/free1/user_avatar/mne.discourse.group/cbrnr/32/1409_2.png) [@cbrnr](https://mne.discourse.group/u/cbrnr)\
**Post date:** [February 13, 2023, 8:10am UTC](https://mne.discourse.group/t/show-extra-events-in-epochs-plot/6334/1 "2023-02-13T08:10:39Z")

</div>

I would like to see additional event types that were not used to create epochs in the epochs plot. This is possible, as @drammock has shown with [his MWE](https://github.com/mne-tools/mne-python/issues/11439#issuecomment-1414450126):

```python
import mne

folder = mne.datasets.sample.data_path()
file = folder / 'MEG' / 'sample' / 'sample_audvis_raw.fif'
raw = mne.io.read_raw_fif(file)

events = mne.find_events(raw, stim_channel='STI 014')
epochs = mne.Epochs(
    raw,
    events,
    event_id={'auditory/right': 2},
    preload=True,
    proj=False
)
epochs['auditory/right'][4:10].plot(events=events)

```

This shows event type 32 in some epochs, even though only event type 2 was used for epoching.

When I try to replicate this with a different data set (available [here](https://ucdavis.app.box.com/v/ERP-Analysis-Book/file/784322947354)), I do not see any extra events:

```python
import mne

raw = mne.io.read_raw_eeglab("6_N400_preprocessed.set", preload=True)
fs = raw.info["sfreq"]
raw.filter(0.2, None)
raw.filter(None, 20)

events, _ = mne.events_from_annotations(raw, event_id=lambda x: int(x))
events = mne.merge_events(events, [111, 112], 111) # prime related
events = mne.merge_events(events, [121, 122], 121) # prime unrelated
events = mne.merge_events(events, [211, 212], 211) # target related
events = mne.merge_events(events, [221, 222], 221) # target unrelated
events = events[2:] # discard first two events

event_id = {
    "prime/related": 111,
    "prime/unrelated": 121,
    "target/related": 211,
    "target/unrelated": 221
}

epochs = mne.Epochs(raw, events, event_id, tmin=-0.2, tmax=1.8)
epochs[:5].plot(events=events)

```

I’d expect to see events of type `201` (`correct` ) or `202` (`incorrect` ) at the end of each epoch, but there is nothing:

 ![Screen Shot 2023-02-13 at 08.52.30](https://global.discourse-cdn.com/free1/uploads/mne/original/2X/8/881b79cbb2b6920a74f8883e162e694eb5ee2620.jpeg)

```python
>>> events[:7]
array([[1327, 0, 121],
       [1550, 0, 221],
       [1663, 0, 201], # <-- within epoch 1
       [1900, 0, 121],
       [2160, 0, 221],
       [2260, 0, 201], # <-- within epoch 3
       [2507, 0, 111]])

```

- MNE version: 1.4.dev0
- OS: macOS 11.7.3

---

<div class="post-metadata">

**Author:** ![drammock](https://yyz2.discourse-cdn.com/free1/user_avatar/mne.discourse.group/drammock/32/4_2.png) [@drammock](https://mne.discourse.group/u/drammock)\
**Post date:** [February 15, 2023, 5:39pm UTC](https://mne.discourse.group/t/show-extra-events-in-epochs-plot/6334/2 "2023-02-15T17:39:28Z")

</div>

just a note to say I can reproduce your result and I am looking into it, but was delayed. I’ll try to get back to it soon.

---

<div class="post-metadata">

**Author:** ![drammock](https://yyz2.discourse-cdn.com/free1/user_avatar/mne.discourse.group/drammock/32/4_2.png) [@drammock](https://mne.discourse.group/u/drammock)\
**Post date:** [June 22, 2023, 7:25pm UTC](https://mne.discourse.group/t/show-extra-events-in-epochs-plot/6334/3 "2023-06-22T19:25:16Z")

</div>

finally getting back to this: there’s a bug in epoch boundary calculation that is causing the `201` events to be wrongly judged as “not inside” the relevant epochs. It’s just luck that the events in my MWE are close enough to the epoch’s zero point to not reveal the bug. I’ll include a fix in [Plot epochs.events by default by cbrnr · Pull Request #11445 · mne-tools/mne-python · GitHub](https://github.com/mne-tools/mne-python/pull/11445)
