Plotting individual epochs before and after ICA

I want to create a plot of two Epochs instances overlayed, specifically before and after applying ICA, to visualize the difference. I found ica.plot_overlay, but this only works with raw or evoked instances. Instead, I’d like to plot individual epochs one by one, similar to epochs.plot, but with both pre- and post-ICA epochs displayed simultaneously for comparison. How can I achieve this?

Hello, you can create an evoked based on a single epoch, too :slight_smile: So you could to something like

ica.plot_overlay(epochs_before_ica[0].average(), exclude=[3])

to get an overlay plot for the very first epoch while excluding ICA component number 3.

Best wishes,
Richard

3 Likes

Thank you for sharing that clever workaround. However, I’m specifically looking for a way to plot all the epochs consecutively, similar to the epochs.plot() function, and then overlay them with the corrected versions. Ideally, I’d like the plot to automatically update each time I modify the Independent Component (IC) selection. This would allow for real-time visualization of the changes as I refine my IC choices. To achieve this I can probably do the same as in Live updating evoked plot when rejecting epochs - #4 by librethinker