0
ネットワークグラフをプロットし、特定のしきい値を上回る中心性スコアを持つgeom_node_textのラベルのみを表示しようとしています。私のコードは以下の通りです:特定の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
あなたの問題は、少なくともいくつかのデータを提供しなければ再現できません。 'centrality'は' rt_tbl'の中で可変ですか? – Tino
はい、中央値はrt_tbl内の変数です。私は今いくつかのデータを追加しました。 –