[FieldTrip] how to specify each channel-color in a topoplot

michele colombo michelecolombo at live.it
Fri May 30 17:19:24 CEST 2014

Dear all,

  My goal is to make a double plot:
1) a subplot with a topoplot of channel-values that are color-mapped,
2) a sorted stem-plot where the stem color is mapped to its height., and 
represent the channel values
The outcome should be more easily interpretable than a colorbar, because 
it would allow to appreciate the whole distribution at a glance, and 
provide spatial info about the distance between colors.

  The first step would be to visualize a 1*num_channels vector plotted 
on the eeg scalp, with the usual topoplot style, and with colors that I 
I compute these values outside of fieldtrip, so I need to re-create the 
expected fieldtrip structure.
Question: how to properly preserve the value-color mapping?

all the intuitive options I tried fail with this respect. somehow the 
colormap given is used as the range of possible color-rgb-values, and 
subsequently the colors are chosen from this map. Instead, I would want 
to actually give the channel-by-channel color value to be plotted on the 
scalp, (interpolating as usual in the space across channels).
attached, you can see a failed attempt: the colormap plotted is 
flattened to a very narrow sub-range of the colomap given.

relevant parts of the used code:
                hh=axes('Position',[.62 .6 .3 .3],'Layer','top'); % 
overlay on plot
% the way i define the colormap. I tried also with a simple: 
                 cfg.colormap= rgbslide(all_chan_stat,'low_color',[0 0 
0.75],'low_val',min(all_chan_stat), ...
                     'zero_color',[0 0.75 
0.75],'zero_val',median(all_chan_stat), ...
                     'high_color',[1 0.9 0],'res',numel(all_chan_stat));
                 if ~isempty([bads_max bads_min])
                     cfg.highlight=sort([bads_max bads_min]); % hilight 
some outliers. this works fine.
                 topoplot(cfg,[all_chan_stat']);  % all_chan_stat is my 
1*num_channels = 257 channels from the EGI system.
% the old-deprecated topoplot function seems more easily accessible than 
the current one, provided I just use fieldtrip to plot, not to compute, 
the values.

               for cc= 1: length(channels)
                         stem(cc, sorted(cc), 'Color', 
cfg.colormap(cc,:), 'MarkerFaceColor', cfg.colormap(cc,:)) ; hold on;

Another option would be to first do the topoplot, given a colormap, then 
to retrieve  the color plotted at each channel (but I don't know how), 
and use these colors to plot the stem

another attempted option:
plot(channels, all_chan_stat)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: topoplot_and_stem-colors.png
Type: image/png
Size: 39798 bytes
Desc: not available
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20140530/592d663a/attachment-0001.png>

More information about the fieldtrip mailing list