plottopo.m
来自「含有多种ICA算法的eeglab工具箱」· M 代码 · 共 897 行 · 第 1/3 页
M
897 行
% plottopo() - plot concatenated multichannel data epochs in a topographic or% rectangular array. Uses a channel location file with the same % format as topoplot(), or else plots data on a rectangular grid. % If data are all positive, they are assumed to be spectra.% Usage:% >> plottopo(data, 'key1', 'val1', 'key2', 'val2')% >> plottopo(data,'chan_locs') % old function call% >> plottopo(data,[rows cols]) % old function call% >> plottopo(data,'chan_locs',frames,limits,title,channels,...% axsize,colors,ydir,vert) % old function call% Inputs:% data = data consisting of consecutive epochs of (chans,frames)% or (chans,frames,n)%% Optional inputs:% 'chanlocs' = [struct] channel structure or file plot ERPs at channel % locations. See help readlocs() for data channel format.% 'geom' = [rows cols] plot ERP in grid (overwrite previous option).% Grid size for rectangular matrix. Example: [6 4].% 'frames' = time frames (points) per epoch {def|0 -> data length}% 'limits' = [xmin xmax ymin ymax] (x's in ms or Hz) {def|0 % (or both y's 0) -> use data limits)% 'ylim' = [ymin ymax] y axis limits. Overwrite option above.% 'title' = [string] plot title {def|'' -> none}% 'chans' = vector of channel numbers to plot {def|0 -> all}% 'axsize' = [x y] axis size {default [.07 .07]}% 'legend' = [cell array] cell array of string for the legend. Note% the last element can be an integer to set legend % position.% 'showleg' = ['on'|'off'] show or hide legend.% 'colors' = [cell array] cell array of plot aspect. E.g. { 'k' 'k--' }% for plotting the first curve in black and the second one% in black dashed. Can also contain additional formating.% { { 'k' 'fontweight' 'bold' } 'k--' } same as above but% the first line is bolded.% 'ydir' = [1|-1] y-axis polarity (pos-up = 1; neg-up = -1) {def -> 1}% 'vert' = [vector] of times (in ms or Hz) to plot vertical lines % {def none}% 'regions' = [cell array] cell array of size nchan. Each cell contains a% float array of size (2,n) each column defining a time region % [low high] to be highlighted.% 'axsize' = [x y] axis size {default [.07 .07]}%% Author: Scott Makeig and Arnaud Delorme, SCCN/INC/UCSD, La Jolla, 3-2-98 %% See also: plotdata(), topoplot()%123456789012345678901234567890123456789012345678901234567890123456789012% Copyright (C) 3-2-98 from plotdata() Scott Makeig, SCCN/INC/UCSD,% scott@sccn.ucsd.edu%% This program is free software; you can redistribute it and/or modify% it under the terms of the GNU General Public License as published by% the Free Software Foundation; either version 2 of the License, or% (at your option) any later version.%% This program is distributed in the hope that it will be useful,% but WITHOUT ANY WARRANTY; without even the implied warranty of% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the% GNU General Public License for more details.%% You should have received a copy of the GNU General Public License% along with this program; if not, write to the Free Software% Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA% $Log: plottopo.m,v $% Revision 1.33 2004/04/06 17:21:38 arno% draw full vertical lines%% Revision 1.32 2004/02/10 16:56:27 arno% error msg%% Revision 1.31 2004/01/29 16:44:32 arno% fix icademo bug%% Revision 1.30 2004/01/29 00:58:04 arno% allowing to plot channels with no coordinates%% Revision 1.29 2003/09/17 01:44:57 arno% debuging for icademo%% Revision 1.28 2003/07/25 17:24:43 arno% allow to plot more than 50 trials%% Revision 1.27 2003/07/16 00:58:35 arno% debug legnd%% Revision 1.26 2003/07/16 00:38:14 arno% fixing ydir%% Revision 1.25 2003/07/16 00:31:18 arno% debug ydir%% Revision 1.24 2003/07/16 00:26:49 arno% debug legend%% Revision 1.23 2003/07/16 00:23:22 arno% debug ydir%% Revision 1.22 2003/07/15 18:37:29 arno% debug color%% Revision 1.21 2003/07/15 17:11:22 arno% allowing empty g.chans & header typo%% Revision 1.20 2003/05/09 23:26:06 arno% debuging regions%% Revision 1.19 2003/03/17 23:38:08 arno% programing ylim option%% Revision 1.18 2003/03/17 23:33:28 arno% debuging regions of interest%% Revision 1.17 2003/03/17 23:05:05 arno% debuging regions%% Revision 1.16 2003/03/17 22:04:41 arno% allow to highlight regions of interest%% Revision 1.15 2003/03/16 02:59:30 arno% debug legend%% Revision 1.14 2003/03/16 02:43:50 arno% allowing to show legend%% Revision 1.13 2003/03/16 01:49:09 arno% debug% last%% Revision 1.12 2003/03/16 01:47:24 arno% allowing setting of each curve color and aspect%% Revision 1.11 2003/03/16 01:22:16 arno% converting to 'key' 'val' parameter sequence%% Revision 1.10 2003/03/05 16:33:29 arno% default linewidth set to 1%% Revision 1.9 2003/03/05 16:27:53 arno% plotting lines after data%% Revision 1.8 2003/03/05 02:25:23 arno% removing warnings and extra CR%% Revision 1.7 2003/02/21 00:36:09 scott% header edit -sm%% Revision 1.6 2002/07/22 22:57:54 arno% swap 2 first colors%% Revision 1.5 2002/04/24 18:24:39 scott% added vert to cal axis -sm%% Revision 1.4 2002/04/24 18:21:35 scott% added vertcolor -sm%% Revision 1.3 2002/04/24 18:19:52 scott% [same] -sm%% Revision 1.2 2002/04/24 17:53:46 scott% added 'vert' vertical line plotting -sm%% Revision 1.1 2002/04/05 17:36:45 jorn% Initial revision%% 5-11-98 added channels arg -sm% 7-15-98 added ydir arg, made pos-up the default -sm% 7-23-98 debugged ydir arg and pos-up default -sm% 12-22-99 added grid size option, changed to sbplot() order -sm% 03-16-00 added axcopy() feature -sm & tpj% 08-21-00 debugged axheight/axwidth setting -sm% 01-25-02 reformated help & license, added links -ad % 03-11-02 change the channel names ploting position and cutomize pop-up -ad % 03-15-02 added readlocs and the use of eloc input structure -ad % 03-15-02 debuging chanlocs structure -ad & sm % 'chan_locs' = file of channel locations as in >> topoplot example {grid}% ELSE: [rows cols] grid size for rectangular matrix. Example: [6 4]% frames = time frames (points) per epoch {def|0 -> data length}% [limits] = [xmin xmax ymin ymax] (x's in ms or Hz) {def|0 % (or both y's 0) -> use data limits)% 'title' = plot title {def|0 -> none}% channels = vector of channel numbers to plot & label {def|0 -> all}% else, filename of ascii channel-name file% axsize = [x y] axis size {default [.07 .07]}% 'colors' = file of color codes, 3 chars per line % ( '.' = space) {0 -> default color order}% ydir = y-axis polarity (pos-up = 1; neg-up = -1) {def -> pos-up}% vert = [vector] of times (in ms or Hz) to plot vertical lines {def none}%function plottopo(data, varargin); %%%%%%%%%%%%%%%%%%%%%% Graphics Settings - can be customized %%%%%%%%%%%%%%%%%%%LINEWIDTH = 1.0; % data line widths (can be non-integer)FONTSIZE = 14; % font size to use for labelsCHANFONTSIZE = 12; % font size to use for channel namesTICKFONTSIZE = 10; % font size to use for axis labelsTITLEFONTSIZE = 16; % font size to use for the plot titlePLOT_WIDTH = 0.75; % width and height of plot array on figurePLOT_HEIGHT = 0.81;gcapos = get(gca,'Position');PLOT_WIDTH = gcapos(3)*PLOT_WIDTH; % width and height of gca plot array on gcaPLOT_HEIGHT = gcapos(4)*PLOT_HEIGHT;MAXCHANS = 256; % can be increased%%%%%%%%%%%%%%%%%%%%% Default settings - use commandline to override %%%%%%%%%%%%DEFAULT_AXWIDTH = 0.07;DEFAULT_AXHEIGHT = 0.07;DEFAULT_SIGN = 1; % Default - plot positive-upISRECT = 0; % defaultISSPEC = 0; % Default - not spectral data if nargin < 1 help plottopo returnendif length(varargin) > 0 if length(varargin) == 1 | ~isstr(varargin{1}) | isempty(varargin{1}) | ... (length(varargin)>2 & ~isstr(varargin{3})) options = { 'chanlocs' varargin{1} }; if nargin > 2, options = { options{:} 'frames' varargin{2} }; end; if nargin > 3, options = { options{:} 'limits' varargin{3} }; end; if nargin > 5, options = { options{:} 'chans' varargin{5} }; end; if nargin > 6, options = { options{:} 'axsize' varargin{6} }; end; if nargin > 7, options = { options{:} 'colors' varargin{7} }; end; if nargin > 8, options = { options{:} 'ydir' varargin{8} }; end; if nargin > 9, options = { options{:} 'vert' varargin{9} }; end; if nargin > 4 & ~isequal(varargin{4}, 0), options = { options{:} 'title' varargin{4} }; end; % , chan_locs,frames,limits,plottitle,channels,axsize,colors,ydr,vert) else options = varargin; end;else options = varargin;end;g = finputcheck(options, { 'chanlocs' '' [] ''; 'frames' 'integer' [1 Inf] size(data,2); 'chans' 'integer' [1 Inf] 0; 'geom' 'integer' [1 Inf] []; 'limits' 'float' [] 0; 'ylim' 'float' [] []; 'title' 'string' [] ''; 'axsize' 'float' [0 1] [nan nan]; 'regions' 'cell' [] {}; 'colors' { 'cell' 'string' } [] {}; 'legend' 'cell' [] {}; 'showleg' 'string' {'on' 'off'} 'on'; 'ydir' 'integer' [-1 1] DEFAULT_SIGN; 'vert' 'float' [] []});if isstr(g), error(g); end;data = reshape(data, size(data,1), size(data,2), size(data,3)); if length(g.chans) == 1 & g.chans(1) ~= 0, error('can not plot a single ERP'); end;[chans,framestotal]=size(data); % data size%%%%%%%%%%%%%%%% Substitute defaults for missing parameters %%%%%%%%%%%%%%%%% axwidth = g.axsize(1);if length(g.axsize) < 2 axheight = NaN;else axheight = g.axsize(2);end;if isempty(g.chans) | g.chans == 0 channelnos = 1:size(data,1);elseif ~isstr(g.chans) channelnos = g.chans;endnolegend = 0;if isempty(g.legend), nolegend = 1; end;if ~isempty(g.ylim) g.limits(3:4) = g.ylim;end;limitset = 0;if length(g.limits)>1 limitset = 1;endif isempty(g.chanlocs) & isempty(g.geom) n = ceil(sqrt(length(channelnos))); g.geom = [n n];end%%%%%%%%%%%%%%%%%%%%%%%%%%%% Test parameters %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% icadefs; % read BACKCOLOR, MAXPLOTDATACHANS constant from icadefs.m
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?