如何像这样在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()
这里只有边缘是彩色的,但我不知道如何编码节点或标签,或者使标签背景半透明。想知道是否有人可以提供帮助。