-
Notifications
You must be signed in to change notification settings - Fork 0
/
plotTrackClasses.m
executable file
·64 lines (54 loc) · 1.87 KB
/
plotTrackClasses.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
%[mu, sigma, hf] = plotTrackClasses(v) generates a bar graph of track categories
%
% Inputs:
% v: vector of track categories (values in [1...8])
% Francois Aguet, 02/01/2012
function [mu, sigma, hf] = plotTrackClasses(v, varargin)
fset = loadFigureSettings('screen');
ip = inputParser;
ip.CaseSensitive = false;
ip.addRequired('v');
ip.addOptional('c', []);
ip.addParamValue('Handle', []);
ip.addParamValue('YLim', []);
ip.addParamValue('YTick', 0:10:100);
ip.addParamValue('FaceColor', fset.cfTrackClasses);
ip.addParamValue('EdgeColor', fset.ceTrackClasses);
ip.parse(v, varargin{:});
xlabels = {'single tracks', 'single tracks, rejected', 'single tracks, cut', 'single tracks, persistent',...
'comp. tracks', 'comp. tracks, rejected', 'comp. tracks, cut', 'comp. tracks, persistent'};
% Setup figure window
if ~isempty(ip.Results.Handle)
ha = ip.Results.Handle;
hf = get(ha, 'Parent');
else
[ha,~,hf] = setupFigure('DisplayMode', 'screen');
end
if iscell(v)
%vpos = cellfun(@(i,j) i(j==1), v, ip.Results.c, 'unif', 0);
%vneg = cellfun(@(i,j) i(j==0), v, ip.Results.c, 'unif', 0);
%v = arrayfun(@(i) hist(vpos{i}, 1:8)/numel(v{i}), 1:numel(v), 'unif', 0);
v = arrayfun(@(i) hist(v{i}, 1:8)/numel(v{i}), 1:numel(v), 'unif', 0);
v = vertcat(v{:});
mu = mean(v,1);
%rstd = @(x) 1/norminv(0.75, 0, 1) * mad(x, 1, 1);
%sigma = rstd(v);
sigma = std(v,[],1);
else
mu = hist(v, 1:8)/numel(v);
sigma = [];
end
mu = 100*mu;
sigma = 100*sigma;
YLim = ip.Results.YLim;
if isempty(YLim)
tmp = mu;
if ~isempty(sigma)
tmp = tmp+sigma;
end
YLim = [0 ceil(max(tmp)/20)*20];
end
barplot2(mu, sigma, 'Handle', ha, 'BarWidth', 0.6, 'GroupDistance', 0.8,...
'FaceColor', ip.Results.FaceColor, 'EdgeColor', ip.Results.EdgeColor,...
'XTickLabel', xlabels, 'YTick', 0:20:100, 'YLim', YLim);
ylabel('% tracks', fset.lfont{:});