-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplot_TwinOrder.m
More file actions
48 lines (40 loc) · 1.7 KB
/
Copy pathplot_TwinOrder.m
File metadata and controls
48 lines (40 loc) · 1.7 KB
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
function plot_TwinOrder(G, metrics, imgSampPath, samp_name, methodName)
% Plot twin order distribution and centrality correlation
twinOrderCounts = histcounts(G.Edges.TwinOrder, 0.5:6.5);
figure('Position', [100 100 1000 800]);
% Twin order distribution
subplot(1,2,1);
bar(1:6, twinOrderCounts, 'FaceColor', [0.3 0.5 0.8]);
xlabel('Twin Order');
ylabel('Number of Twin Connections');
ylim([0 max(twinOrderCounts) * 1.15]);
%ylim([0 650])
title('Twin Orders');
xticks(1:6);
PrettyPlotsSingle
% Twin order by centrality
subplot(1,2,2);
highCentralityNodes = find(metrics.betweenCent > prctile(metrics.betweenCent, 75));
edgeNodes = G.Edges.EndNodes;
highCentEdges = any(ismember(edgeNodes, highCentralityNodes), 2);
twinOrdersHigh = G.Edges.TwinOrder(highCentEdges);
twinOrdersLow = G.Edges.TwinOrder(~highCentEdges);
hold on;
histogram(twinOrdersHigh, 0.5:6.5, 'FaceColor', [0.8 0.3 0.3], 'FaceAlpha', 0.6);
histogram(twinOrdersLow, 0.5:6.5, 'FaceColor', [0.3 0.3 0.8], 'FaceAlpha', 0.6);
maxCount = max([histcounts(G.Edges.TwinOrder(highCentEdges), 0.5:6.5), ...
histcounts(G.Edges.TwinOrder(~highCentEdges), 0.5:6.5)]);
ylim([0 maxCount * 1.15]);
xlabel('Twin Order');
ylabel('Number of Twin Connections');
title('Twin Order by Node Centrality');
legend({'High Centrality'; 'Low Centrality'}, 'Location', 'northeast');
%ylim([0 450])
xlim([0 6.5])
xticks(1:6);
hold off;
PrettyPlotsSingle
set(gcf, 'color', 'w');
export_fig(char(fullfile(imgSampPath, sprintf('%s_twinOrder_analysis_%s.png', samp_name, methodName))), '-m2');
close
end