# EEGlab: Gracefully overwrite the default colormap

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

https://www.reddit.com/r/matlab/comments/1jqk8t/you_should_never_use_the_default_colors_in_matlab/

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

“

set(0,'DefaultFigureColormap',parula); 

“

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 new icadefs.m

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

“

run([fileparts(which(‘eegrej’)) filesep ‘icadefs.m’]);
DEFAULT_COLORMAP = ‘parula’;

“

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

Important: The folder to your icadef file must be above eeglab in your path.

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:

### 2 Comments

1. · 18. May 2017 Reply

Hi Benedikt,

this indeed looks much nicer than the default colormap! I’ve been playing around with the colormaps a little bit and it seems like, in my MATLAB version (r2016a), ‘parula’ is different from what you’ve shown here. This was also confirmed by Google 😉

Your colormap is really nice, though, could you tell us readers how to access it in MATLAB?

Cheers,
Marius