plotsig

PURPOSE ^

Function to plot C where it is higher than a threshold sig

SYNOPSIS ^

function plotsig(C,sig,t,f,c)

DESCRIPTION ^

 Function to plot C where it is higher than a threshold sig
 useful for plotting coherence
 Usage: plotsig(C,sig,t,f)
 Inputs:
 C: input array t x f - also works for a single vector
 sig: significance level
 t: t axis grid for plot
 f: f axis grid for plot.
 c: color to use (default blue)-only meaningful for a line plot

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function plotsig(C,sig,t,f,c)
0002 % Function to plot C where it is higher than a threshold sig
0003 % useful for plotting coherence
0004 % Usage: plotsig(C,sig,t,f)
0005 % Inputs:
0006 % C: input array t x f - also works for a single vector
0007 % sig: significance level
0008 % t: t axis grid for plot
0009 % f: f axis grid for plot.
0010 % c: color to use (default blue)-only meaningful for a line plot
0011 if nargin < 4; error('Need at least 4 arguments'); end;
0012 if nargin < 5 | isempty(c); c='b'; end;
0013 [T,F]=size(C);
0014 if F==1; C=C'; [T,F]=size(C);end;
0015 if T~=length(t) | F~=length(f);
0016     error('frequency and/or time axes are incompatible with data'); 
0017 end;
0018 if T==1;
0019     dim=max(T,F);
0020     C=C(:);
0021     indx=find(C>sig);
0022     plot(f,C,c); 
0023 %     plot(f,C,f,mask.*C)
0024     line(get(gca,'xlim'),[sig sig]);
0025     xlabel('f'); ylabel('|C|');
0026 else
0027     mask=zeros(T,F);
0028     for n=1:length(t);
0029         for m=1:length(f);
0030            if C(n,m)>sig
0031               mask(n,m)=1;
0032            end;
0033         end;
0034     end;
0035     imagesc(t,f,(mask.*C)'); axis xy; colorbar
0036     xlabel('t'); ylabel('f');
0037 end;

Generated on Fri 12-Aug-2011 11:36:15 by m2html © 2005