# Option to preselect dropped epochs in interactive epochs plot

**URL:** <https://mne.discourse.group/t/option-to-preselect-dropped-epochs-in-interactive-epochs-plot/7660>\
**Category:** Support & Discussions\
**Tags:** preprocessing, visualization, epochs, autoreject\
**Created:** [October 11, 2023, 1:05pm UTC](https://mne.discourse.group/t/option-to-preselect-dropped-epochs-in-interactive-epochs-plot/7660 "2023-10-11T13:05:47Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![MathisJording](https://yyz2.discourse-cdn.com/free1/user_avatar/mne.discourse.group/mathisjording/32/3100_2.png) [@MathisJording](https://mne.discourse.group/u/MathisJording)\
**Post date:** [October 11, 2023, 1:05pm UTC](https://mne.discourse.group/t/option-to-preselect-dropped-epochs-in-interactive-epochs-plot/7660/1 "2023-10-11T13:05:47Z")

</div>

Dear all,

is there a way to plot an entire epochs object (including ‘bad’ epochs) but with bad epochs already being marked red? So is there a way to prespecify a selection of epochs when calling the plot() function that will then be plotted in red as if one had already left-clicked on them in the plot?

Normally, all epochs that were marked as bad in the drop\_log are omitted when plotting. When I then plot the epoch object, I can mark additional epochs as bad (by left clicking) which will then be colored red and I can also reverse this by left clicking again. However, I would like to see the omitted epochs inbetween that were dropped in earlier steps as well and potentially also be able to take them into the selection again (so to delete the “bad” mark).

I am using MNE version 1.5.1 on a Windows-10 os.

It feels like somebody would have asked this or a similiar question already or that it might be mentioned in the documentation but I wasn’t able to find it. So my apologies if I have missed it. Thank you very much in advance!

Best regards,  
Mathis

---

<div class="post-metadata">

**Author:** ![richard](https://yyz2.discourse-cdn.com/free1/user_avatar/mne.discourse.group/richard/32/15_2.png) [@richard](https://mne.discourse.group/u/richard)\
**Post date:** [October 13, 2023, 10:41pm UTC](https://mne.discourse.group/t/option-to-preselect-dropped-epochs-in-interactive-epochs-plot/7660/2 "2023-10-13T22:41:45Z")

</div>

Hello @MathisJording, to my knowledge, bad epochs are dropped immediately. So … there simply isn’t any data to plot! Hence, I’m afraid what you’re asking for is simply not possible in MNE-Python at the moment. Sorry!

Best wishes,  
Richard

---

<div class="post-metadata">

**Author:** ![MathisJording](https://yyz2.discourse-cdn.com/free1/user_avatar/mne.discourse.group/mathisjording/32/3100_2.png) [@MathisJording](https://mne.discourse.group/u/MathisJording)\
**Post date:** [October 14, 2023, 1:31pm UTC](https://mne.discourse.group/t/option-to-preselect-dropped-epochs-in-interactive-epochs-plot/7660/3 "2023-10-14T13:31:08Z")

</div>

Hi @richard!

too bad but thanks a lot for the answer! Should I find some kind of workaround I will post it here.

Best  
Mathis

---

<div class="post-metadata">

**Author:** ![martin](https://avatars.discourse-cdn.com/v4/letter/m/73ab20/32.png) [@martin](https://mne.discourse.group/u/martin)\
**Post date:** [October 16, 2023, 4:56pm UTC](https://mne.discourse.group/t/option-to-preselect-dropped-epochs-in-interactive-epochs-plot/7660/4 "2023-10-16T16:56:20Z")

</div>

I’ve been wanting to do the same thing! While I haven’t yet devised a solution but what got me close is make a copy of the epochs and compare what it has against the epochs object with bads dropped. You can then plot the copied version with colors for what was dropped, but then you have to manually re-select the rejected epochs.

---

<div class="post-metadata">

**Author:** ![richard](https://yyz2.discourse-cdn.com/free1/user_avatar/mne.discourse.group/richard/32/15_2.png) [@richard](https://mne.discourse.group/u/richard)\
**Post date:** [October 16, 2023, 5:40pm UTC](https://mne.discourse.group/t/option-to-preselect-dropped-epochs-in-interactive-epochs-plot/7660/5 "2023-10-16T17:40:59Z")

</div>

@mscheltienne Would it be possible to pass a list of indices for “bad” epochs to mne-qt-browser, such as:

```python
epochs = mne.Epochs(...)
epochs_bad_idx = [0, 10, 35]
epochs.plot(bads= epochs_bad_idx)

```

and pre-select those indices as “bad”?

And then to take it a step further, how about a `drop_bads_on_close` parameter:

```python
epochs_bad_idx_new = epochs.plot(bads=epochs_bad_idx, drop_bads_on_close=False)

```

… just brainstorming here …

---

<div class="post-metadata">

**Author:** ![mscheltienne](https://yyz2.discourse-cdn.com/free1/user_avatar/mne.discourse.group/mscheltienne/32/827_2.png) [@mscheltienne](https://mne.discourse.group/u/mscheltienne)\
**Post date:** [October 16, 2023, 10:08pm UTC](https://mne.discourse.group/t/option-to-preselect-dropped-epochs-in-interactive-epochs-plot/7660/6 "2023-10-16T22:08:21Z")

</div>

Sounds good to me, we just need to find which variable stores internally those “bad” epochs on-the-fly. I don’t have the time to look at it this week, could you open an issue to keep track?
