❝本节继续来绘制NC上的一张图表,ggraph绘制网络图,数据为论文源数据,小编根据个人对数据的理解进行了绘图,结果与原图有所出入,整个过程仅参考「重点在于绘图数据整理」。希望对各位观众老爷能有所帮助。❞
library(tidyverse)
library(magrittr)
library(tidygraph)
library(ggraph)
other attached packages:
[1] tidygraph_1.3.0 ggsci_3.0.0 MetBrewer_0.2.0 magrittr_2.0.3 igraph_1.6.0 ggforce_0.4.2
[7] graphlayouts_1.0.2 ggraph_2.1.0 lubridate_1.9.3 forcats_1.0.0 stringr_1.5.1 dplyr_1.1.4
[13] purrr_1.0.2 readr_2.1.5 tidyr_1.3.1 tibble_3.2.1 ggplot2_3.5.0 tidyverse_2.0.0
ggraph(df_igraph,layout = 'graphopt')+
geom_edge_link(aes(edge_colour =Correlation),edge_width = 0.5)+
geom_node_point(aes(fill = Type,color=Type),shape = 21,size=5,show.legend = T)+
geom_node_text(aes(label = name),repel = TRUE)+
scale_edge_colour_gradientn(colors=c("#F4B5BD","#F7949A","#FB7478",
"#FD4F52","#FE2729","#FF0000"))+
scale_fill_manual(values = c("#3C5488FF","#E64B35FF","#4DBBD5FF","#00A087FF"))+
scale_color_manual(values = c("#3C5488FF","#E64B35FF","#4DBBD5FF","#00A087FF"))+
theme(legend.background = element_blank(),
panel.background = element_blank())