Home > FMAToolbox > Plot > PlotCCG.m

PlotCCG

PURPOSE ^

PlotCCG - Plot auto/cross-correlograms of point processes.

SYNOPSIS ^

function PlotCCG(t,ccg,varargin)

DESCRIPTION ^

PlotCCG - Plot auto/cross-correlograms of point processes.

  USAGE

    PlotCCG(t,ccg)

    t              time bins obtained using <a href="matlab:help CCG">CCG</a>
    ccg            data obtained using <a href="matlab:help CCG">CCG</a>
    <options>      optional list of property-value pairs (see table below)

    =========================================================================
     Properties    Values
    -------------------------------------------------------------------------
     'full'        'on' to plot all correlograms, 'off' to plot only upper
                   triangular matrix of correlograms (default)
    =========================================================================

  SEE

    See also CCG, CCGParameters, ShortTimeCCG.

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function PlotCCG(t,ccg,varargin)
0002 
0003 %PlotCCG - Plot auto/cross-correlograms of point processes.
0004 %
0005 %  USAGE
0006 %
0007 %    PlotCCG(t,ccg)
0008 %
0009 %    t              time bins obtained using <a href="matlab:help CCG">CCG</a>
0010 %    ccg            data obtained using <a href="matlab:help CCG">CCG</a>
0011 %    <options>      optional list of property-value pairs (see table below)
0012 %
0013 %    =========================================================================
0014 %     Properties    Values
0015 %    -------------------------------------------------------------------------
0016 %     'full'        'on' to plot all correlograms, 'off' to plot only upper
0017 %                   triangular matrix of correlograms (default)
0018 %    =========================================================================
0019 %
0020 %  SEE
0021 %
0022 %    See also CCG, CCGParameters, ShortTimeCCG.
0023 
0024 % Copyright (C) 2010-2013 by Michaƫl Zugaro
0025 %
0026 % This program is free software; you can redistribute it and/or modify
0027 % it under the terms of the GNU General Public License as published by
0028 % the Free Software Foundation; either version 3 of the License, or
0029 % (at your option) any later version.
0030 
0031 % Default values
0032 full = false;
0033 
0034 if nargin < 2,
0035     error('Incorrect number of parameters (type ''help <a href="matlab:help PlotCCG">PlotCCG</a>'' for details).');
0036 end
0037 
0038 if ~isdvector(t),
0039     error('Incorrect times bins (type ''help <a href="matlab:help PlotCCG">PlotCCG</a>'' for details).');
0040 end
0041 if length(t) ~= size(ccg,1),
0042     error('Inconsistent time bins and cross-correlogram data (type ''help <a href="matlab:help PlotCCG">PlotCCG</a>'' for details).');
0043 end
0044 
0045 % Parse parameter list
0046 for i = 1:2:length(varargin),
0047     if ~ischar(varargin{i}),
0048         error(['Parameter ' num2str(i+2) ' is not a property (type ''help <a href="matlab:help CCG">CCG</a>'' for details).']);
0049     end
0050     switch(lower(varargin{i})),
0051         case 'full',
0052             full = lower(varargin{i+1});
0053             if ~isastring(full,'on','off'),
0054                 error('Incorrect value for property ''full'' (type ''help <a href="matlab:help CCG">CCG</a>'' for details).');
0055             end
0056             full = strcmp(full,'on');
0057         otherwise,
0058             error(['Unknown property ''' num2str(varargin{i}) ''' (type ''help <a href="matlab:help CCG">CCG</a>'' for details).']);
0059     end
0060 end
0061 
0062 [~,nCols,nRows] = size(ccg); % reference series in columns, referenced series in rows
0063 if nCols ~= nRows && ~full,
0064     warning('Unequal numbers of rows and columns - forcing ''full'' mode');
0065     full = true;
0066 end
0067 
0068 if full,
0069     for col = 1:nCols,
0070         for row = 1:nRows,
0071             subplot(nRows,nCols,col+nCols*(nRows-row));
0072             b = bar(t,ccg(:,col,row));
0073             xlim([min(t) max(t)]);
0074             set(b,'EdgeColor','k','FaceColor','k');
0075             if col == 1,
0076                 ylabel(int2str(row));
0077             end
0078         end
0079         if col == row,
0080             xlabel('Time (s)');
0081         else
0082             set(gca,'xtick',[]);
0083         end
0084         if row == nRows,
0085             title(int2str(col));
0086         end
0087     end
0088 else
0089     n = size(ccg,2);
0090     for col = 1:n,
0091         for row = col:n,
0092             subplot(n,n,col+n*(n-row));
0093             b = bar(t,ccg(:,col,row));
0094             xlim([min(t) max(t)]);
0095             if col == row,
0096                 set(b,'EdgeColor','none','FaceColor','b');
0097             else
0098                 set(b,'EdgeColor','k','FaceColor','k');
0099             end
0100             if col == 1,
0101                 ylabel(int2str(row));
0102             end
0103         end
0104         if col == row,
0105             xlabel('Time (s)');
0106         else
0107             set(gca,'xtick',[]);
0108         end
0109         if row == n,
0110             title(int2str(col));
0111         end
0112     end
0113 end
0114 
0115

Generated on Fri 16-Mar-2018 13:00:20 by m2html © 2005