[英]how to color the nodes and labels in ggraph
如何像這樣在ggraph圖中指定邊緣的顏色
library(ggraph)
library(igraph)
df_school = highschool %>% mutate(yr=ifelse(year%%2==0,'purple','blue'))
graph = df_school %>% graph_from_data_frame()
V(graph)$node_label = names(V(graph))
ggraph(graph, layout = 'linear', circular = TRUE) +
geom_edge_arc(aes(colour = factor(year))) +
geom_node_label(aes(label=node_label), alpha=0.2) +
scale_edge_colour_identity()
這里只有邊緣是彩色的,但我不知道如何對節點或標簽進行編碼,或者使標簽背景半透明。 想知道是否有人可以提供幫助。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.