Can I put tags on the nodes?
Are you referring to the following question?
Drawing a network of nodes in circular formation with links between nodes
A general method to add textual labels to a graph is to use the text
command. Note that it requires the coordinates for each label. It’s also recommended to make sure that the label doesn’t overlap with the node.
The following example follows this answer, and simply adds a small radial offset to each coordinate before displaying the label at that 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);
for k = idx;
text(x(k) + dx(k), y(k) + dy(k), tags{k}) %// Add label
end
This is the result:
How can I modify the connecting lines?
Again, this answer shows you how: modify ind1
and ind2
accordingly to hold the pairs that you want to connect (each two corresponding elements in ind1
and ind2
make a pair).
For example, if you’re interested only in connecting nodes (1,10), (2,16), (3,23) and (6,19), use the following values for ind1
and ind2
:
ind1 = [1 2 3 6];
ind2 = [10 16 23 19];
Running the code for the new connections values produces the following plot:
13
solved Drawing Social graph in matlab and tag nodes [closed]