-
Notifications
You must be signed in to change notification settings - Fork 9
/
plotTree.m
58 lines (40 loc) · 1.33 KB
/
plotTree.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
function plotTree(T, dataset)
adjMatrix = zeros(max(T.clu_id));
nZeros = sum(T.pa==0);
for index = nZeros+1:length(T.pa)
adjMatrix(T.pa(index),T.clu_id(index)) = 1;
end
clusterSizes = zeros(max(T.s),1);
for index = 1:length(clusterSizes)
clusterSizes(index) = sum(T.s==index);
end
plotClusterSizes = clusterSizes/max(clusterSizes)*50;
sizeScale = 3;
a = 1:max(T.clu_id);
IDS = cellstr(num2str(a(:)));
BG = biograph(adjMatrix, IDS);
BGH = view(BG);
% %From the old version
% nodeHandlers = BGH.Nodes;
%
% for indexNode = 1:length(nodeHandlers)
% set(BGH.Nodes(indexNode),'Size', 1+floor([plotClusterSizes(indexNode)/sizeScale plotClusterSizes(indexNode)/sizeScale]), 'Shape','circle')
% end
%
% g = biograph.bggui(BGH);
% % adjustBGPlot
% f = figure('Color', 'w','pos',[520 80 554 718]);
% %Replace by the newer version 1
% % adjustBGPlot
% f = figure('Color', 'w', 'pos',g.biograph.hgAxes.Position .* [1 1 1.5 1.5]);
% copyobj(g.biograph.hgAxes,f);
% %Replace by the newer version 2
g = biograph.bggui(BGH);
f = figure('Color', 'w', 'pos',g.biograph.hgAxes.Position .* [1 1 1.5 1.5]);
copyobj(g.biograph.hgAxes,f);
delete(BGH)
delete(g)
[~, ~, ~, ~, ~, ~, ~, figuresDir] = initialization(dataset);
filenameFigure = fullfile(figuresDir, 'tree.jpg');
saveas(gcf, filenameFigure,'jpg')
end