-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathplot_net.m
More file actions
70 lines (60 loc) · 1.75 KB
/
Copy pathplot_net.m
File metadata and controls
70 lines (60 loc) · 1.75 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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
function plot_net(xyz,node_sz,color_indx,cij,flag_edges)
%FCN_PLOT_NET plot of network
%
% [F,H] = FCN_PLOT_NET(XYZ,NODE_SZ,COLOR_INDX,CIJ) generates plot of
% network with connectivity matrix CIJ.
%
% Inputs: XYZ xyz node coordinates
% NODE_SZ vector of node sizes
% COLOR_INDX vector used to specify node color
% CIJ weighted/binary symmetric connectivity
% matrix
%
% Outputs: F figure handle
% H axis handle
%
% NOTE: for visualization, it maybe wise to threshold CIJ beforehand.
%
% Richad Betzel, Indiana University, 2012
%nodes of interest NOI
p = size(xyz,2);
in1 = node_sz ~= 0;
in2 = color_indx ~= 0;
ind = in1 & in2;
%cij = cij(ind,ind);
cij = (cij./max(cij(:))).*50;
noi = size(cij,1);
node_sz = node_sz(ind)+7;
color_indx = color_indx(ind);
xyz = xyz(ind,:);
clrs = jet(64);
color_indx = (color_indx - min(color_indx))./max(color_indx);
color_indx = floor(color_indx*63) + 1;
f = figure;
h = axes;
hold(h,'on');
if flag_edges
for i = 1:noi-1
for j = i+1:noi
if cij(i,j)
xx = [xyz(i,1),xyz(j,1)];
yy = [xyz(i,2),xyz(j,2)];
zz = [xyz(i,3),xyz(j,3)];
plot3(xx,yy,zz,'k','linewidth',.5);
end
end
end
end
for i = 1:length(ind)
switch p
case 2
plot(xyz(i,1),xyz(i,2),'ko','markersize',node_sz(i)...
,'markerfacecolor',clrs(color_indx(i),:));
case 3
plot3(xyz(i,1),xyz(i,2),xyz(i,3),'ko'...
,'markersize',node_sz(i)...
,'markerfacecolor',clrs(color_indx(i),:));
end
end
axis image;
axis off;