gateHistDen : makes a probability density plot for the list of cells in the clist table for the given clist index. It first gates the list if there is a gate field in clist. INPUT : clist : list of cells with time-independent info ind : indices of clist definition used for x and y label [x,y] xx : array of two values, the subtraction of which is the size of each bin. cc : color of plot OUTPUT : y : probability density xx : values of clist(ind) Copyright (C) 2016 Wiggins Lab Written by Paul Wiggins. University of Washington, 2016 This file is part of SuperSegger. SuperSegger 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 3 of the License, or (at your option) any later version. SuperSegger 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 SuperSegger. If not, see <http://www.gnu.org/licenses/>.
0001 function [y,xx] = gateHistDen(clist, ind, cc,xx) 0002 % gateHistDen : makes a probability density plot for the list of cells 0003 % in the clist table for the given clist index. 0004 % It first gates the list if there is a gate field in clist. 0005 % 0006 % INPUT : 0007 % clist : list of cells with time-independent info 0008 % ind : indices of clist definition used for x and y label [x,y] 0009 % xx : array of two values, the subtraction of which is the size of each bin. 0010 % cc : color of plot 0011 % OUTPUT : 0012 % y : probability density 0013 % xx : values of clist(ind) 0014 % 0015 % 0016 % Copyright (C) 2016 Wiggins Lab 0017 % Written by Paul Wiggins. 0018 % University of Washington, 2016 0019 % This file is part of SuperSegger. 0020 % 0021 % SuperSegger is free software: you can redistribute it and/or modify 0022 % it under the terms of the GNU General Public License as published by 0023 % the Free Software Foundation, either version 3 of the License, or 0024 % (at your option) any later version. 0025 % 0026 % SuperSegger is distributed in the hope that it will be useful, 0027 % but WITHOUT ANY WARRANTY; without even the implied warranty of 0028 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 0029 % GNU General Public License for more details. 0030 % 0031 % You should have received a copy of the GNU General Public License 0032 % along with SuperSegger. If not, see <http://www.gnu.org/licenses/>. 0033 0034 clist = gate(clist); 0035 ss = size( clist.data ); 0036 NUM_CELLS = ss(1); 0037 NUM_BINS = round(sqrt(NUM_CELLS)); 0038 0039 if ~exist( 'xx', 'var' ) 0040 xx = []; 0041 else 0042 dx = xx(2) - xx(1); 0043 start = min(clist.data(:,ind)); 0044 stop = max(clist.data(:,ind)); 0045 xx = start:dx:stop; 0046 end 0047 0048 if ~exist( 'cc', 'var' ) || isempty(cc) 0049 cc = 'b'; 0050 end 0051 0052 0053 nind = numel( ind ); 0054 0055 if nind == 1 0056 if isempty( xx ) 0057 [y,xx] = hist(clist.data(:,ind), NUM_BINS ); 0058 else 0059 [y,xx] = hist(clist.data(:,ind), xx ); 0060 end 0061 0062 dx = xx(2)-xx(1); 0063 plot( xx, y/dx/NUM_CELLS, '.-', 'Color', cc ); 0064 tmp = ishold; 0065 hold on 0066 plot( mean(clist.data(:,ind))+[0,0], [max(y),min(y(y>0))]/dx/NUM_CELLS, ':', 'Color', cc ); 0067 0068 if ~tmp 0069 hold off; 0070 end 0071 0072 ylabel('Population Density'); 0073 xlabel(clist.def{ind}); 0074 else 0075 disp('Error in getHist: too many indices in ind'); 0076 end 0077 0078 0079 0080 end