I am trying to plot a network graph and show only the labels for the geom_node_text that have a centrality score above a specific threshold. My code is below:
rt_tbl %>%
mutate(centrality = centrality_authority()) %>%
ggraph(layout = 'kk') +
geom_edge_link(aes(), colour = "gray", alpha = 0.5) +
geom_node_point(aes(size = centrality, colour = centrality)) +
geom_node_text(data=subset(centrality > 0.6), aes(centrality, label=name)) +
theme_graph(base_family = "Roboto Condensed", base_size = 13)
I encounter the following error:
Error in subset(centrality > 100) : object 'centrality' not found
My data looks like this:
# A tbl_graph: 1589 nodes and 3992 edges
# A directed multigraph with 3 components
# Node Data: 1,589 x 3 (active)
name degree centrality
<chr> <dbl> <dbl>
1 Ashinlay1970 35 0.90053429
2 WinTunMin1 25 0.66408597
3 Yaminayeyaohn1 2 0.06080755
4 TUNOO00655880 3 0.07609831
5 inewagency 8 0.21569006
6 KSwe03 4 0.12416238
# ... with 1,583 more rows
# Edge Data: 3,992 x 2
from to
<int> <int>
1 1 48
2 1 49
3 1 1
# ... with 3,989 more rows