0

The dataset I need to plot is very large and is two-modes. One is about students and another is about projects they share.

I use igraph and tried several layouts. None of them is satisfactory. Layout with kk is relatively informative. Here is what it looks like:

layout with kk

Green and big ones are projects while small and pink ones are students.

I want to label them so that more information can be gained. But the plot is so intense and haa a lot of overlaps. Other layouts would be worse.

Can someone give some help? Like how to advoid overlap? How to add labels, no need to all of them, but at least to some hubs?

Here are my codes:

net <- graph_from_incidence_matrix(links)
V(net)$color[1:2621] <- rgb(1,0,0,.5)
V(net)$color[2622:4326] <- rgb(0,1,0,.5)
V(net)$label <- V(net)$name
V(net)$label.color <- rgb(0,0,.2,.5)
V(net)$label[1:2621] <- NA
V(net)$color[1:2621] <-  rgb(1,0,0,.1)
V(net)$size[1:2621] <- 3
V(net)$size[2621:4326] <- 5
E(net)$curved <- FALSE
l1 <- layout_with_kk(net)
plot(net, layout=l1,vertex.label=NA,edge.width =E(net)$weight)
Miya Wang
  • 219
  • 2
  • 3
  • 7

1 Answers1

1

If you know which labels you want to show, you can assign vertex.label a vector, specifying those.

Also removing are changing the color of the node borders via vertex.frame.color might be useful.

For example:

 r <- make_ring(10)
 showlabels <- seq(1,10)
 showlabels[showlabels %% 2 != 0] <- NA 
 plot(r, vertex.label = showlabels, vertex.frame.color = NA)
Sylvia
  • 129
  • 7