Drawing Social graph in matlab and tag nodes -
i need social network graph.
1.) can put tags on nodes?
2.) how can modify connecting lines?
the social network graph should this.
can put tags on nodes?
are referring following question?
drawing network of nodes in circular formation links between nodes
a general method add textual labels graph use text
command. note requires coordinates each label. it's recommended make sure label doesn't overlap node.
the following example follows this answer, , adds small radial offset each coordinate before displaying label @ position:
idx = 1:numel(x); tags = cellstr(num2str(idx(:)), '%0d'); %// generate string labels [dx, dy] = pol2cart(theta, 0.1); %// small radial offset dx = dx - 0.05 * (sign(x) < 0); k = idx; text(x(k) + dx(k), y(k) + dy(k), tags{k}) %// add label end
this result:
how can modify connecting lines?
again, this answer shows how: modify ind1
, ind2
accordingly hold pairs want connect (each 2 corresponding elements in ind1
, ind2
make pair).
for example, if you're interested in connecting nodes (1,10), (2,16), (3,23) , (6,19), use following values ind1
, ind2
:
ind1 = [1 2 3 6]; ind2 = [10 16 23 19];
running code new connections values produces following plot:
Comments
Post a Comment