0

I am trying to do a social network analysis of the activists on Twitter and I am having trouble to label the nodes or the communities in the network

After I collected data, and transform the data to have a list of Twitter users. I then use the codes below to plot the network:

plot <- network %>% filter(community %in% 1:3) %>% mutate(node_size = ifelse(degree_c >= 20,degree_c,0.06)) %>% mutate(node_label = ifelse(betweenness_c >= 0.06,name,"")) %>%  ggraph(layout = "stress") +
  geom_edge_fan(alpha = 0.05) +
  geom_node_point(aes(color = as.factor(community),size = node_size)) +
  geom_node_label(aes(label = node_label),repel = T,
                  show.legend = F, fontface = "bold", label.size = 3,
                  segment.colour="slateblue", fill = "#ffffff66") +
  coord_fixed() +
  theme_graph() + theme(legend.position = "none") +
  labs(title = "network analysis")

print(plot)

And I plotted a graph like this:

enter image description here

(I blurred the username for ethical considerations)

I can see that the labels of two key densely connected nodes in the network. I am wondering if there are any codes that can show the label for the rest of the nodes as well?

Thank you!

p.s. an example of my dataset

> dput(head(network))
new("dgCMatrix", i = c(0L, 9L, 11L, 13L, 
13L, 14L, 15L, 29L, 34L, 35L, 36L, 38L, 39L, 40L, 52L,Dim = c(6L, 591L),  Dimnames = list(c("NA", "UserA", 
    "UserB", "UserC", "UserD", "UserE", 
    "UserF", "UserG", "UserH", "UserI", "UserJ", "UserK", "UserL", 
    "UserM", "UserN",)), x = c(1, 1, 2, 2, 1, 2, 2, 2, 2, 2, 2, 1, 
    2, 2, 2), factors = list())
Qian
  • 37
  • 6

0 Answers0