Coloring of individual EEG Electrodes raw.plot

Is there a way of coloring different electrodes using raw.plot according to a color map? From the docs it seems the only difference in coloring that is available is between different types of signals, ie out of the following:

            dict(mag='darkblue', grad='b', eeg='k', eog='k', ecg='m',
                 emg='k', ref_meg='steelblue', misc='k', stim='k',
                 resp='k', chpi='k')

Ideally this is what I would want to do:

import mne

mne_file = '<any_edf>.edf'
raw = mne.io.read_raw_edf(mne_file, preload=True, verbose='warning')
raw.plot(n_channels=2, scalings='auto', show=True, block=True, color={'Fp1': 'red', 'Fp2': 'green'});

(The above screenshot should have red and green colors instead)

  • MNE version: 1.9.0

Unfortunately no, you can only customize the colors per type (mne.io.Raw — MNE 1.10.0 documentation).

it’s actually possible for epochs however, using the epoch_colors parameter. It accepts a list-of-lists, where the outer list is the number of epochs in the object, and the inner list is the number of channels. So you could in theory convert the raw to a single big epoch, then pass epoch_colors=[['r', 'g']] (assuming you have only 2 channels)

1 Like

Hi drammock,

How can I convert it to a single epoch? I’ve tried and didn’t quite work, possibly because I have events and annotations in my eeg?

To create a single epoch you could use mne.make_fixed_length_epochs() and set duration to be the duration of your raw data.

In case your data contains some segments marked a BAD you should set reject_by_annotation=False, otherwise it will think there are no valid epochs in your data.

2 Likes