我需要在 R 中加入两个网络图,只是在第一个上覆盖第二个。
我与您分享更多细节:我的第一个图是这种形式的最大生成树:
g1 <- graph_from_adjacency_matrix(m4, mode = "upper", weighted = T, diag = F)
max_spann_tree2 <- mst(g1, weights = -E(g)$weight)
max_spann_tree2<-asNetwork(max_spann_tree2)
ggnet2(max_spann_tree2 ,size = nlav1,size.cut = 4, edge.size = 1, edge.color = "grey", color = "he1", color.legend = "industry", palette = "Set3")
max_spann_tree2 具有以下结构:
> max_spann_tree2
Network attributes:
vertices = 181
directed = FALSE
hyper = FALSE
loops = FALSE
multiple = FALSE
bipartite = FALSE
total edges= 180
missing edges= 0
non-missing edges= 180
Vertex attribute names:
he1 vertex.names
我需要把这张图叠加
net55<-asNetwork(net5)
ggnet2(net55 ,size = nlav5,size.cut = 4, edge.size = 1, edge.color = "grey", color = "he5", color.legend = "industry", palette = "Set3")
net5 的结构如下:
> net5
IGRAPH 3893673 UNW- 87 250 --
+ attr: name (v/c), he (v/c), nlav (v/n), ateco (v/c), weight (e/n)
+ edges from 3893673 (vertex names):
[1] A1013--A1621 A1039--A1051 A1039--A1089 A1041--A1051 A1041--A1061 A1041--A1071 A1041--A1073 A1041--A2312
[9] A1041--A2369 A1041--A2370 A1041--A2512 A1041--A6910 A1041--A6920 A1041--A7112 A1051--A2512 A1051--A7420
+ ... omitted several edges
我尝试使用 uniongraph 没有成功。有什么建议可以合并这两个情节吗?我可以直接合并两个 ggnet2 图吗?还是我应该做点别的?提前致谢