-
Notifications
You must be signed in to change notification settings - Fork 247
/
pop_plottopo.m
131 lines (116 loc) · 5.11 KB
/
pop_plottopo.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
% POP_PLOTTOPO - plot one or more concatenated multichannel data epochs
% in a topographic array format using PLOTTOPO
% Usage:
% >> pop_plottopo( EEG ); % pop-up
% >> pop_plottopo( EEG, channels );
% >> pop_plottopo( EEG, channels, title, singletrials);
% >> pop_plottopo( EEG, channels, title, singletrials, axsize, ...
% 'color', ydir, vert);
%
% Inputs:
% EEG - input dataset
% channels - indices of channels to plot
% title - plot title. Default is none.
% singletrials - [0|1], 0 plot average, 1 plot individual
% single trials. Default is 0.
% others... - additional plottopo arguments {'axsize', 'color', 'ydir'
% 'vert'} (see >> help plottopo)
%
% Author: Arnaud Delorme, CNL / Salk Institute, 10 March 2002
%
% See also: PLOTTOPO
% Copyright (C) 10 March 2002 Arnaud Delorme, Salk Institute, arno@salk.edu
%
% This file is part of EEGLAB, see http://www.eeglab.org
% for the documentation and details.
%
% Redistribution and use in source and binary forms, with or without
% modification, are permitted provided that the following conditions are met:
%
% 1. Redistributions of source code must retain the above copyright notice,
% this list of conditions and the following disclaimer.
%
% 2. Redistributions in binary form must reproduce the above copyright notice,
% this list of conditions and the following disclaimer in the documentation
% and/or other materials provided with the distribution.
%
% THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
% AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
% IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
% ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
% LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
% CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
% SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
% INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
% CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
% ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
% THE POSSIBILITY OF SUCH DAMAGE.
% 01-25-02 reformated help & license -ad
% 02-16-02 text interface editing -sm & ad
% 03-18-02 added title -ad & sm
% 03-30-02 added single trial capacities -ad
function com = pop_plottopo( EEG, channels, plottitle, singletrials, varargin);
com = '';
if nargin < 1
help pop_plottopo;
return;
end;
if nargin < 2
uilist = { { 'style' 'text' 'string' 'Channels to plot' } ...
{ 'style' 'edit' 'string' [ '1:' num2str( EEG.nbchan ) ] 'tag' 'chan' } ...
{ 'style' 'text' 'string' 'Plot title' } ...
{ 'style' 'edit' 'string' fastif(isempty(EEG.setname), '',EEG.setname) 'tag' 'title' } ...
{ 'style' 'text' 'string' 'Plot single trials' } ...
{ 'style' 'checkbox' 'string' '(set=yes)' 'tag' 'cbst' } ...
{ 'style' 'text' 'string' 'Plot in rect. array' } ...
{ 'style' 'checkbox' 'string' '(set=yes)' 'tag' 'cbra' } ...
{ 'style' 'text' 'string' 'Other plot options (see help)' } ...
{ 'style' 'edit' 'string' '''ydir'', 1' 'tag' 'opt' } };
geometry = { [1 1] [1 1] [1 1] [1 1] [1 1] };
[result, userdata, tmphalt, restag] = inputgui('uilist', uilist, 'geometry', geometry, 'helpcom', 'pophelp(''pop_plottopo'')', 'title', 'Topographic ERP plot - pop_plottopo()');
if length(result) == 0
return;
end
channels = eval( [ '[' restag.chan ']' ] );
plottitle = restag.title;
singletrials = restag.cbst;
addoptions = eval( [ '{' restag.opt '}' ] );
rect = restag.cbra;
figure('name', ' plottopo()');
options ={ 'frames' EEG.pnts 'limits' [EEG.xmin EEG.xmax 0 0]*1000 ...
'title' plottitle 'chans' channels addoptions{:} };
if ~rect
options = { options{:} 'chanlocs' EEG.chanlocs };
end
else
options ={ 'chanlocs' EEG.chanlocs 'frames' EEG.pnts 'limits' [EEG.xmin EEG.xmax 0 0]*1000 ...
'title' plottitle 'chans' channels varargin{:}};
addoptions = {};
end
% adapt frames to time limit.
if any(strcmp(addoptions,'limits'))
addoptions{end+1} = 'frames';
ilimits = find(strcmp(addoptions,'limits'))+1;
timelims = addoptions{ilimits}(1:2);
addoptions{end+1} = round(diff(timelims/1000)*EEG.srate);
end
try, icadefs; set(gcf, 'color', BACKCOLOR); catch, end
if exist('plottitle') ~= 1
plottitle = '';
end;
if exist('singletrials') ~= 1
singletrials = 0;
end;
if singletrials
plottopo( EEG.data, options{:} );
else
plottopo( mean(EEG.data,3), options{:} );
end
if ~isempty(addoptions)
com = sprintf('figure; pop_plottopo(EEG, %s, ''%s'', %d, %s);', ...
vararg2str(channels), plottitle, singletrials, vararg2str(addoptions));
else
com = sprintf('figure; pop_plottopo(EEG, %s, ''%s'', %d);', ...
vararg2str(channels), plottitle, singletrials);
end
return;