EEGlab: Gracefully overwrite the default colormap

EEGlab has ‘jet’ as the default colormap. But jet is pretty terrible

You see structure where there is none (e.g. rings in the third example).

The problem:

Eeglabs sets the default colormap to ‘jet’, thus overwriting a system wide default set e.g. by


<code>set(0,'DefaultFigureColormap',parula); </code>



It does so by calling icadefs.m  in various functions (e.g. topoplot, erpimage) and defining:


DEFAULT_COLORMAP = 'jet'



We want to overwrite the one line, but keep it forward compatible i.e. we do not want to copy the whole icadefs file, but just replace the single line whenever icadefs is called.

Solutions

Overwrite the line in icadefs.m default

This has the benefit that it will always work irrespective of your path-ordering. The con is, you will loose the change if you switch eeglab versions or update eeglab.

Change/create your eeglab eeg_options.txt.

This has the benefit that it will carry over to the next version of eeglab, but it is an extra file you need to have somewhere completly different than your project-folder (your user-folder ~/eeg_options.txt). It is thereby hard to make selfcontained code.

Make a file called icadefs.m (this script will be called instead of the eeglab icadef) and add the following code:


DEFAULT_COLORMAP = 'parula';



This will call the original icadef (in the same folder as eegrej.m and then overwrite the eeglab-default

Try this: edit('icadefs.m') to see which function comes up. If the eeglab-one comes up you have a path conflict here. Your own icadefs has to be above the eeglab one.

In my project_init.m where I add all paths, I make sure that eeglab is started before adding the path to the new icadefs.m

Examples:

ICA – Topoplots of a single subject

Single component of an IC-Decomposition that included noisy data portions (and thus, I would say, is not usable)

Categorized: Blog

Tagged: