我正在使用tidygraph和ggraph绘制网络。有没有办法选择性地操纵节点?具体来说,分别是大小和颜色。
# example data
rstat_nodes <- data.frame(name = c("Hadley", "David", "Romain", "Julia"))
rstat_edges <- data.frame(from = c(1, 1, 1, 2, 3, 3, 4, 4, 4),
to = c(2, 3, 4, 1, 1, 2, 1, 2, 3))
gr <- tbl_graph(nodes = rstat_nodes, edges = rstat_edges)
as_tbl_graph(gr) %>%
mutate(centrality = centrality_degree(normalized = T)) %>%
ggraph(layout = 'auto') +
#geom_edge_link() +
geom_edge_arc(curvature=0.2,alpha=0.5) +
geom_node_point(aes(size = 0.2, colour = centrality)) +
scale_color_viridis(guide = 'legend') +
ggtitle("Network Degree Centrality (Normalized)") +
theme_graph()