I am trying to draw a web of network but trying to put nodes in the same group close together.
'data' is the link data of two firms and I created a graph data named 'net', and 'group' is the attribute of nodes that I want to put nodes close based on.
y = data.frame(data$firm_id_1, data$firm_id_2)
net = graph.data.frame(y, directed = F)
V(net)$group = group
colors = rainbow(length(unique(group)))
set.seed(222)
l = layout_on_sphere(net)
plot(net,
vertex.color = colors[group],
vertex.size = 3,
edge.arrow.size = 0.1,
edge.color = 'grey',
vertex.label.cex = 0.1,
layout = l)
And this is the result that I got. I can see that all different colored nodes spread out.
But I want to make the nodes in the same color (group) close together. And it would be good if I can keep this sphere shape of the web. Can anyone help me with this?