📄 plota.m
字号:
function H=plota(X,arg2,arg3,arg4,arg5,arg6,arg7)
% PLOTA plots all kind of data types
%
% PLOTA(X [,Mode])
%
% X.datatype determines type of data
% DATATYPE Mode
% 'MVAR' 'SPECTRUM'
% 'MVAR' 'Phase'
% 'MVAR', 'COHERENCE'
% 'MVAR' 'DTF'
% 'MVAR' 'PDC'
% 'TF-MVAR' Time-frequency MVAR analysis
% e.g. plota(X, 'PDC', hf, [,alpha]); %
%
% 'MEAN+STD'
% plota(X,hf,minmean,maxmean,maxstd [,trigger])
% arg1 ... R
% arg2 ... hf (handles to figures)
% arg3 ... minmean (minimum of mean)
% arg4 ... maxmean (maximum of mean)
% arg5 ... maxstd (maximum of standard deviation)
% arg6 ... trigger (trigger instant) [optional]
%
% 'HISTOGRAM' 'log' chansel
% 'HISTOGRAM' 'log+' chansel
% 'HISTOGRAM' 'log ' chansel
% 'HISTOGRAM' 'lin' chansel
%
% 'SIESTA_HISTOGRAM' chansel
%
% 'DBI-EPs'
% 'TSD1'
% 'TSD_BCI7'
% 'MDist-matrix'
% 'MD'
% 'SCATTER'
% 'STAT2'
% ''
% ''
% 'REV' Mode='3D'
% 'REV' Mode='2D'
%
% REFERENCE(S):
% $Revision: 1.29 $
% $Id: plota.m,v 1.29 2004/08/31 07:14:11 schloegl Exp $
% Copyright (C) 1999-2003 by Alois Schloegl <a.schloegl@ieee.org>
% 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.
h = [];
if ~isfield(X,'datatype');
return;
end;
if strcmp(X.datatype,'MVAR-COHERENCE'),
fprintf(2,'datatype "%s" is will become obsolete.\n\Use datatye = MVAR instead\n',X.datatype);
%fprintf(2,'datatype "%s" is will become obsolete.\n\Use datatye = MVAR instead\n',X.datatype);
if length(size(X.COH))==3,
M = size(X.COH,1);
if nargin<2,
list2=1:size(X.COH,1);
list1=1:size(X.COH,2);
list3=1:size(X.COH,3);
else
list2=arg2;
list1=arg3;
list3=arg4';
end;
for k1 = 1:length(list1);
for k2 = 1:length(list2);
s = subplot(length(list2),length(list1),k1+(k2-1)*length(list1));
tmp = abs(squeeze(X.COH(list2(k2),list1(k1),list3)));
if isfield(X,'ci'),
if isfield(X,'p'),
h = plot(list3,[abs(tmp),tanh([atanh(tmp)*[1,1]+ones(size(tmp))*X.ci*sqrt(1/2/(min(X.N)-X.p))*[1,-1]])]);
else
h = plot(list3,[abs(tmp),tanh(atanh(tmp)+X.ci/(sqrt(X.N))),tanh(atanh(tmp)-X.ci/(sqrt(X.N)))]);
end
set(h(2),'color',[0 0.8 1]);
set(h(3),'color',[0 0.8 1]);
set(h(1),'color',[0 0 1]);
axis([min(list3),max(list3),-0.5,1.2])
else
area(list3,abs(tmp));
axis([min(list3),max(list3),0,1])
end;
if isfield(X,'ElectrodeName'),
if k1==1,
y=ylabel(X.ElectrodeName(list2(k2)));
set(y,'FontSize',6);
end;
if k2==1,
t = title(X.ElectrodeName(list1(k1)));
set(t,'FontSize',6);
end;
end;
set(s,'FontSize',6);
end
end;
suptitle('Ordinary coherence')
elseif (length(size(X.COH))==4) & ((size(X.COH,4)==2) | (size(X.COH,4)==3)) ,
if nargin<2,
list2=1:size(X.COH,1);
list1=1:size(X.COH,2);
list3=1:size(X.COH,3);
else
list2=arg2;
list1=arg3;
list3=arg4';
end;
M = size(X.COH,1);
for k1 = 1:length(list1);
for k2 = 1:length(list2);%k1:M;
s = subplot(length(list2),length(list1),k1+(k2-1)*length(list1));
hold on
if isfield(X,'U')
% with interval confidence and significant
% difference
tmp = abs(squeeze(X.COH(list2(k2),list1(k1),list3,1)));
tmpU = abs(squeeze(X.U(list2(k2),list1(k1),list3,1)));
tmpL = abs(squeeze(X.L(list2(k2),list1(k1),list3,1)));
h = plot(list3,[tmp,tmpU,tmpL]);
set(h(1),'color',[0.2 0.2 1]);
set(h(2),'color',[0.9 0.9 1]);
set(h(3),'color',[0.9 0.9 1]);
tmp = abs(squeeze(X.COH(list2(k2),list1(k1),list3,2)));
tmpU = abs(squeeze(X.U(list2(k2),list1(k1),list3,2)));
tmpL = abs(squeeze(X.L(list2(k2),list1(k1),list3,2)));
h = plot(list3,[tmp,tmpU,tmpL]);
set(h(1),'color',[0.2 0.8 0.2]);
set(h(2),'color',[0.8 1 0.8]);
set(h(3),'color',[0.8 1 0.8]);
plot(list3,squeeze(X.DS(list1(k1),list2(k2),list3)),'.r')
else
% 2 or 3 curves without ci
tmp = abs(squeeze(X.COH(list2(k2),list1(k1),list3,1)));
h = plot(list3,abs(tmp));
set(h(1),'color',[0 0 1]);
tmp = abs(squeeze(X.COH(list2(k2),list1(k1),list3,2)));
h = plot(list3,abs(tmp));
set(h(1),'color',[0 1 0]);
if (size(X.COH,4)==3)
tmp = abs(squeeze(X.COH(list2(k2),list1(k1),list3,3)));
h = plot(list3,abs(tmp));
set(h(1),'color',[1 0 0]);
end
end
hold off
axis([min(list3),max(list3),-0.2,1.0])
if isfield(X,'ElectrodeName'),
if k1==1,
y=ylabel(X.ElectrodeName(list2(k2)));
set(y,'FontSize',6);
end;
if k2==1,
t = title(X.ElectrodeName(list1(k1)));
set(t,'FontSize',6);
end;
end;
set(s,'FontSize',6);
end;
end
suptitle('Ordinary coherence')
elseif length(size(X.COH))==4,
if nargin<2,
list2=1:size(X.COH,1);
list1=1:size(X.COH,2);
list3=1:size(X.COH,3);
else
list2=arg2;
list1=arg3;
list3=arg4';
end;
M = size(X.COH,1);
for k1 = 1:length(list1);
for k2 = 1:length(list2);
s = subplot(length(list2),length(list1),k1+(k2-1)*length(list1));
tmp = abs(squeeze(X.COH(list2(k2),list1(k1),list3,:)));
[a,b] = meshgrid(X.t,list3);
mesh(a,b,abs(tmp));
v = axis; v(5:6)=[0,1]; axis(v);
xlabel('Time','FontSize',6);
ylabel('Freq','FontSize',6);
set(s,'FontSize',6);
if isfield(X,'ElectrodeName'),
if k1==1,
y=ylabel(X.ElectrodeName(list2(k2)));
set(y,'FontSize',6);
end;
if k2==1,
t = title(X.ElectrodeName(list1(k1)));
set(t,'FontSize',6);
end;
end;
end;
end;
suptitle('Time-varying Coherence')
figure;
for k1 = 1:length(list1);
for k2 = 1:length(list2);
s = subplot(length(list2),length(list1),k1+(k2-1)*length(list1));
tmp = abs(squeeze(X.COH(list2(k2),list1(k1),list3,:)));
imagesc(X.t,list3,tmp,[0 1]);
axis([min(X.t) max(X.t) min(list3) max(list3)])
xlabel('Time','FontSize',5);
ylabel('Freq','FontSize',5);
set(s,'YDir','normal','FontSize',5);
c = colorbar;
set(c,'FontSize',5);
if isfield(X,'ElectrodeName'),
if k1==1,
y=ylabel(X.ElectrodeName(list2(k2)));
set(y,'FontSize',6);
end;
if k2==1,
t = title(X.ElectrodeName(list1(k1)));
set(t,'FontSize',6);
end;
end;
end
end
suptitle('Time-varying Coherence')
elseif length(size(X.COH))==5,
if nargin<2,
list2=1:size(X.COH,1);
list1=1:size(X.COH,2);
list3=1:size(X.COH,3);
else
list2=arg2;
list1=arg3;
list3=arg4';
end;
[M1,M2,M3,M4,M5] = size(X.COH);
load cmap;
for k1=1:length(list1)
for k2=1:length(list2)
colormap(cmap);
s = subplot(length(list2),length(list1),k1+(k2-1)*length(list1));
tmp = abs(squeeze(X.DS(list2(k2),list1(k1),list3,:)));
imagesc(tmp,[-1,1]);
xlabel('Time','FontSize',5);
ylabel('Freq','FontSize',5);
set(s,'YDir','normal','FontSize',5);
c = colorbar;
set(c,'FontSize',5);
if isfield(X,'ElectrodeName'),
if k1==1,
y=ylabel(X.ElectrodeName(list2(k2)));
set(y,'FontSize',6);
end;
if k2==1,
t = title(X.ElectrodeName(list1(k1)));
set(t,'FontSize',6);
end;
end;
end
end
suptitle('Significane difference of time-varying Coherence')
end;
elseif strcmp(X.datatype,'MVAR-DTF'),
fprintf(2,'datatype "%s" is will become obsolete.\n\Use datatye = MVAR instead\n',X.datatype);
if length(size(X.DTF))==3,
if nargin<2,
list2=1:size(X.COH,1);
list1=1:size(X.COH,2);
list3=1:size(X.COH,3);
else
list2=arg2;
list1=arg3;
list3=arg4';
end;
M = size(X.DTF,1);
for k1=1:length(list1)
for k2=1:length(list2)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -