visualizing epochs and events: colours not showing

Hi,
I am trying to visualize some epoched data, but the colours or names of each stimulus do not show up when I plot the data.

I also tried just plotting the epochs related to one of the stimuli (named ‘prestimulus’), but I kept getting all epochs, rather than the selection. Eventhough the output from print(epochsN2N3[“prestimulus”]) showed the correct selection.
The events do show up in the right colours in the raw object.

Perhaps I am missing something very obvious, but would be great if anyone could help :slight_smile:
Thanks!

MNE version 1.3.1
Windows

# Epoching settings
tmin =  0  # start of each epoch (in sec)
tmax =  1.7  # end of each epoch (in sec)

# Create epochs from stimuli in N2/N3
epochsN2N3 = mne.Epochs(raw_ref_LM[0],
                    events_N2N3, 
                    tmin=tmin, 
                    tmax=tmax,
                    event_id=event_dictN2N3,
                    baseline=None, 
                    preload=True 
                   ) 

epochsN2N3.plot(
    events=events_N2N3,
    event_id=event_dictN2N3,
    event_color={"prestimulus":"red", "Stimulus/S  1":"blue", "Stimulus/S  2":"blue"},
    scalings = 150e-6
)


#tried plotting epochs from one event only
print(epochsN2N3["prestimulus"])
epochsN2N3["prestimulus"].plot(
    events=events_N2N3,
    event_id=event_dictN2N3,
    event_color={"prestimulus":"red"},
    scalings = 150e-6
)

The following code works for me with the sample dataset. Maybe you can use this as a starting point? I tested it with MNE-Python 1.4.0.

Best wishes,
Richard

# %%
import mne

sample_dir = mne.datasets.sample.data_path()
sample_fname = sample_dir / "MEG" / "sample" / "sample_audvis_raw.fif"

raw = mne.io.read_raw_fif(sample_fname)
raw.crop(tmax=60)

events = mne.find_events(raw, stim_channel="STI 014")
event_id = {
    "auditory/left": 1,
    "auditory/right": 2,
    "visual/left": 3,
    "visual/right": 4,
    "face": 5,
    "buttonpress": 32,
}

epochs = mne.Epochs(
    raw,
    events=events,
    event_id=event_id,
    tmin=-0.2,
    tmax=0.5,
    baseline=(None, 0),
    preload=True,
)

# %%
epochs['auditory'].plot(
    events=epochs.events,
    event_id=epochs.event_id,
    event_color={
        'auditory/left': 'red',
        'auditory/right': 'green',
    },
    n_epochs=5,
)

Thank you for checking! I realised it was not showing up because I was used 0 as tmin, which I guess was just cutting off the events themselves.