Home > SuperSegger > gate > gateHistDot.m

gateHistDot

PURPOSE ^

gateHistDot : plots dot plot of two quantities in the clist.

SYNOPSIS ^

function [y,xx,xarr_s,yarr_s,zvals_s] = gateHistDot(clist, ind, xx)

DESCRIPTION ^

 gateHistDot : plots dot plot of two quantities in the clist.
 The quantities are plot using a jet color map to identify the most dense 
 bins.

 INPUT : 
   clist : array of cells versus variable produced from superSegger 
   ind : array containing the two clist indices you wish to use
   xx : (optional) 2x1 array of preset bins for histogram i.e [20 20]

 OUTPUT :
   y : matrix of 2D histogram values
   xx : 2x1 Cell array where, xx{1} and xx{2} are the bins used to generate y
   zvals_s : array of number of elements in each bin in increasing order
   xarr_s : array of x bin centers; x(i) is the x value corresponding zvals_s(i)
   yarr_s : array of y bin centers; y(i) is the y value corresponding zvals_s(i)


 Copyright (C) 2016 Wiggins Lab 
 Written by Julie Cass, Stella Stylianidou, 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/>.

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function [y,xx,xarr_s,yarr_s,zvals_s] = gateHistDot(clist, ind, xx)
0002 % gateHistDot : plots dot plot of two quantities in the clist.
0003 % The quantities are plot using a jet color map to identify the most dense
0004 % bins.
0005 %
0006 % INPUT :
0007 %   clist : array of cells versus variable produced from superSegger
0008 %   ind : array containing the two clist indices you wish to use
0009 %   xx : (optional) 2x1 array of preset bins for histogram i.e [20 20]
0010 %
0011 % OUTPUT :
0012 %   y : matrix of 2D histogram values
0013 %   xx : 2x1 Cell array where, xx{1} and xx{2} are the bins used to generate y
0014 %   zvals_s : array of number of elements in each bin in increasing order
0015 %   xarr_s : array of x bin centers; x(i) is the x value corresponding zvals_s(i)
0016 %   yarr_s : array of y bin centers; y(i) is the y value corresponding zvals_s(i)
0017 %
0018 %
0019 % Copyright (C) 2016 Wiggins Lab
0020 % Written by Julie Cass, Stella Stylianidou, Paul Wiggins.
0021 % University of Washington, 2016
0022 % This file is part of SuperSegger.
0023 %
0024 % SuperSegger is free software: you can redistribute it and/or modify
0025 % it under the terms of the GNU General Public License as published by
0026 % the Free Software Foundation, either version 3 of the License, or
0027 % (at your option) any later version.
0028 %
0029 % SuperSegger is distributed in the hope that it will be useful,
0030 % but WITHOUT ANY WARRANTY; without even the implied warranty of
0031 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0032 % GNU General Public License for more details.
0033 %
0034 % You should have received a copy of the GNU General Public License
0035 % along with SuperSegger.  If not, see <http://www.gnu.org/licenses/>.
0036 
0037 ss = size( clist.data );
0038 NUM_BINS = round((sqrt(ss(1))));
0039 clist = gate(clist);
0040 
0041 if ~exist( 'xx', 'var' );
0042     xx = round(([ NUM_BINS, NUM_BINS]));
0043 end
0044 
0045 if numel( ind ) ~= 2
0046     error ('clist indices must be two')
0047 end
0048 
0049 if ind(1) > size(clist.data,2)
0050     error('index one outside clist range')
0051 end
0052 
0053 if ind(2) > size(clist.data,2)
0054     error('index two outside clist range')
0055 end
0056 
0057 if ~sum(~isnan(clist.data(:,ind(2)))) || ~sum(~isnan(clist.data(:,ind(1)))) 
0058     error('no data for the quantities you chose') 
0059 end
0060 
0061 % 3d histogram
0062 % y : number of elements in each bin
0063 % xx : 1x2 cell array with positions of bin centers
0064 x2 = clist.data(:,ind(2));
0065 x1 = clist.data(:,ind(1));
0066 
0067 x1_min = min(x1);
0068 x1_max = max(x1);
0069 x1_mean  = (x1_max+x1_min)/2;
0070 x1_delta = 1.33*(x1_max-x1_min);
0071 
0072 x1_dd = ((0:xx(1))/xx(1)-0.5)*x1_delta + x1_mean;
0073 
0074 x2_min = min(x2);
0075 x2_max = max(x2);
0076 x2_mean  = (x2_max+x2_min)/2;
0077 x2_delta = 1.33*(x2_max-x2_min);
0078 
0079 x2_dd = ((0:xx(2))/xx(2)-0.5)*x2_delta + x2_mean;
0080 
0081 
0082 xx = {x2_dd,x1_dd};
0083 
0084 
0085 [y,xx] =hist3([clist.data(:,ind(2)),clist.data(:,ind(1))], xx );
0086 
0087 
0088 % xvasl, yvals : positions of bin centers
0089 xvals = x2;
0090 yvals = x1;
0091 y2 = interp2( xx{1}, xx{2}, y', xvals, yvals, 'linear');
0092 y = y2;
0093 
0094 
0095 [y,ord] = sort(y, 'ascend');
0096 xvals = xvals(ord);
0097 yvals = yvals(ord);
0098 
0099 %y = log(y);
0100 
0101 scatter( yvals, xvals, 10, y, 'filled' );
0102 
0103 colormap(jet)
0104 
0105 if size(clist.def,2) >= ind
0106     yname = clist.def{ind(2)};
0107     xname = clist.def{ind(1)};
0108     ylabel( yname );
0109     xlabel( xname );
0110 end
0111 
0112 set(gca,'Box','on');
0113 set(gca,'YScale','log');
0114 
0115 
0116 
0117 end

Generated on Thu 19-Jan-2017 13:55:21 by m2html © 2005