将标签放入R ggraph包中的节点中

将标签放入R ggraph包中的节点中,r,label,nodes,ggraph,R,Label,Nodes,Ggraph,我正在尝试使用ggraph可视化网络。我的代码如下: ggraph(x, layout = "fr") + geom_edge_link(aes(width = weight), alpha = 0.50, edge_color = "grey20") + geom_node_point(color = "black", size = 12, show.legend = FALSE, family = "serif&q

我正在尝试使用ggraph可视化网络。我的代码如下:

ggraph(x, layout = "fr") +
  geom_edge_link(aes(width = weight), alpha = 0.50, edge_color = "grey20") +
  geom_node_point(color = "black", size = 12, show.legend = FALSE, family = "serif") +
  geom_node_label(aes(label = name),  
                  repel = TRUE, show.legend = FALSE, family = "serif") +
  theme_graph(background = "white")
它将生成以下网络绘图片段:

是否可以在ggraph中的节点内创建标签?我试过geom_node_标签和geom_node_文本,但它们都不是这样的。我还上传了一个我在下面想的例子:

我非常感谢你的帮助。祝大家夏天健康。

geom\u node\u text()
是正确的。文本是隐藏的,因为它是黑对黑的

x <- data.frame('from' = c(1,2,3,4), 'to' = c(3,3,1,1), 'weight' = c(1,1,1,1))

ggraph(x, layout = "fr") +
  geom_edge_link(aes(width = weight), alpha = 0.50, edge_color = "grey20") +
  geom_node_point(color = "black", size = 12, show.legend = FALSE, family = "serif") +
  geom_node_text(aes(label = name),  colour = 'white', size=10,
                  show.legend = FALSE, family = "serif") +
  theme_graph(background = "white")
x