我正在尝试绘制网络图并仅显示 geom_node_text 的标签,这些标签的中心度得分高于特定阈值。我的代码如下:
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)
我遇到以下错误:
Error in subset(centrality > 100) : object 'centrality' not found
我的数据如下所示:
# 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