R:大(?)visNetwork表现不佳

时间:2017-05-02 14:14:33

标签: r vis.js

我试图代表一个护理网络(disease -> hospital)。我使用visNetwork。这是我网络上的一些细节:2540个顶点和15776个边缘。这里只使用1000条边的结果: visNetwork with 1000 edges 而只有500条边可读:visNetwork with 500 edges 在允许这些图表的代码之后:

visNetwork(nodes=vn_nodes,edges = vn_edges, height = "1000px",width="100%")%>%
visPhysics(enabled = FALSE)%>%
visLayout(randomSeed = 12)

我玩了一些选项,但没有结果。任何让它变得有用的想法或者我是否需要更改包装(我已经尝试过networkD3而没有真正满意)?

编辑:(添加一些数据)

edges

    >vn_nodes
           label   id title group
3     INSEE06004 2469   123     I
4     INSEE06088 2470  2393     I
5     INSEE10387 2471    91     I
6     INSEE13055 2472    75     I
7     INSEE13056 2473    54     I
8     INSEE13205 2474  4192     I
9     INSEE14118 2475   443     I
11    INSEE20004 2477    13     I
12    INSEE20033 2478    32     I
13    INSEE21231 2479  2309     I
14    INSEE25056 2480    35     I
15    INSEE28085 2481    48     I
16    INSEE29019 2482  2266     I
18    INSEE30189 2484   194     I
19    INSEE33063 2485  3080     I
20    INSEE34172 2486  5245     I
21    INSEE35238 2487  3869     I
22    INSEE37261 2488  2639     I
23    INSEE38516 2489  2493     I
25    INSEE44109 2491  3083     I
26    INSEE49007 2492  1330     I
27    INSEE51454 2493  1144     I
28    INSEE54395 2494  1304     I
30    INSEE54547 2496  1839     I
31    INSEE56260 2497   412     I
33    INSEE59183 2499   220     I
34    INSEE59350 2500  7339     I
35    INSEE59606 2501   351     I
36    INSEE60340 2502    32     I
37    INSEE62041 2503   706     I
38    INSEE62160 2504    10     I
39    INSEE62498 2505  1019     I
40    INSEE63113 2506  1526     I
41    INSEE64102 2507    50     I
42    INSEE64445 2508    15     I
43    INSEE67482 2509  3382     I
44    INSEE69029 2510  2905     I
45    INSEE71076 2511    71     I
46    INSEE72181 2512  1312     I
47    INSEE75112 2513   460     I
48    INSEE75113 2514   342     I
50    INSEE75115 2516  3333     I
51    INSEE75118 2517    15     I
52    INSEE75119 2518  6813     I
53    INSEE78498 2519    84     I
54    INSEE80021 2520  2378     I
55    INSEE83050 2521   116     I
56    INSEE83137 2522   285     I
57    INSEE84007 2523   132     I
58    INSEE86194 2524  1351     I
59    INSEE89024 2525    68     I
61    INSEE92024 2527     5     I
62    INSEE92025 2528   101     I
63    INSEE93010 2529    87     I
64    INSEE94028 2530   560     I
65    INSEE95500 2531   126     I
66    INSEE97120 2532   464     I
67    INSEE97209 2533   229     I
69    INSEE97302 2535   389     I
70    INSEE97311 2536   233     I
71    INSEE97416 2537   895     I
72    INSEE98735 2538   121     I
73    INSEE98818 2539    44     I
74       ORPHA10   35     3     O
89      ORPHA100  374     3     O
108  ORPHA100011 1510     1     O
110  ORPHA100013 2179     1     O
111  ORPHA100031 1038     1     O
120  ORPHA100033 2461     1     O
121  ORPHA100043 1946     1     O
122  ORPHA100092 1170     1     O
124    ORPHA1001  136     4     O
140  ORPHA100973   27     7     O
158  ORPHA100980  761     5     O
171  ORPHA100981 1649     3     O
175  ORPHA100982 1342     4     O
181     ORPHA101 2142     2     O
182  ORPHA101016  762     1     O
192  ORPHA101023  289     1     O
218  ORPHA101029 1912     1     O
219  ORPHA101033 1708     1     O
220  ORPHA101038 1010     1     O
226  ORPHA101039  763     4     O
232  ORPHA101063  764     1     O
238  ORPHA101070 1511     2     O
244  ORPHA101075 1512     1     O
247  ORPHA101076 1513     1     O
250  ORPHA101081  834     3     O
265  ORPHA101082 1786     1     O
267  ORPHA101088 1913     3     O
268  ORPHA101090 1861     1     O
270  ORPHA101097 1343     1     O
272  ORPHA101150 1344     1     O
275  ORPHA101330  765     1     O
278  ORPHA101685  290     4     O
329    ORPHA1018 1810     2     O
330  ORPHA101944 1011     1     O
334  ORPHA101950  766     1     O
335    ORPHA1020 1391     1     O
336  ORPHA102002  291     3     O
355  ORPHA102009 1012     1     O
358  ORPHA102010  767     1     O
366  ORPHA102013  292     2     O
368  ORPHA102283   28    31     O
418  ORPHA102284   29     4     O
469  ORPHA102285  293     1     O
517  ORPHA102369   30    12     O
555  ORPHA102373 1345     1     O
556    ORPHA1027 2019     1     O
557     ORPHA103  375     1     O
573    ORPHA1031 1241     1     O
578    ORPHA1034  137     1     O
609    ORPHA1037  138     3     O
627  ORPHA103918 1787     1     O
628     ORPHA104 1043     3     O
647  ORPHA104003 2127     1     O
648  ORPHA104007 1171     1     O
651  ORPHA104009 2128     1     O
653  ORPHA104010 1788     1     O
656  ORPHA104013 1789     1     O
657  ORPHA104075 2288     1     O
658    ORPHA1041  890     3     O
674    ORPHA1046 1811     1     O
675    ORPHA1047 1555     1     O
676    ORPHA1048  891     4     O
697     ORPHA105 1356     1     O
704    ORPHA1052  325     1     O
723    ORPHA1053 1556     1     O
726    ORPHA1054  494     1     O
731    ORPHA1055 1392     1     O
732    ORPHA1057 1242     1     O
735    ORPHA1059 1670     1     O
738     ORPHA106    7     7     O
789    ORPHA1062 1671     1     O
790    ORPHA1064 2218     1     O
791    ORPHA1065 1557     1     O
796    ORPHA1068 2260     1     O
797     ORPHA107   48    12     O
830    ORPHA1071  345    10     O
844    ORPHA1072 1393     1     O
846    ORPHA1081  495     1     O
848    ORPHA1083  496     1     O
853    ORPHA1084 1558     3     O
856    ORPHA1088 2429     1     O
857  ORPHA108959 1709     1     O
859  ORPHA108961 1990     1     O
860  ORPHA108963 1013     1     O
861  ORPHA108967 1014     1     O
865  ORPHA108969 1947     2     O
868  ORPHA108971 1514     1     O
872  ORPHA108973 2129     1     O
873  ORPHA108977  294     1     O
877  ORPHA108979 1991     1     O
878  ORPHA108981  768     1     O
890  ORPHA108983 1650     1     O
892  ORPHA108985  355     1     O
898  ORPHA108989 1515     1     O
910  ORPHA108991 1172     2     O
913     ORPHA109  376     1     O
923  ORPHA109007  295     3     O
940  ORPHA109009  769     1     O
946  ORPHA109011  296     1     O
969      ORPHA11  836     1     O
972     ORPHA110   49     1     O
1003   ORPHA1104 1243     1     O
1004    ORPHA111 1044     2     O
1010   ORPHA1114  497     1     O
1017   ORPHA1117 2313     2     O
1018   ORPHA1118 1953     1     O
1021    ORPHA112   50     2     O
1033   ORPHA1125 1077     1     O
1039   ORPHA1126 1672     1     O
1040    ORPHA113 1207     1     O
1042   ORPHA1132  498     2     O
1045   ORPHA1134 1078     1     O
1046   ORPHA1135 2219     1     O
1047   ORPHA1136 1394     1     O
1061   ORPHA1138 1673     1     O
1062   ORPHA1143 1079     1     O

2 个答案:

答案 0 :(得分:0)

您可以定义碰撞和其他选项,以便标签不会覆盖scaling.label.enabled

从网络的精美文档中检查所有选项。 enter link description here

答案 1 :(得分:0)

  

我不能使用排斥因为我已禁用

FWIW,以下是您可以尝试所有different layout algorithms及其参数化的方法:

library(igraph)
library(visNetwork)
library(qgraph)
g <- graph_from_data_frame(vn_edges)
V(g)$color <- bipartite.mapping(g)$type + 1L
V(g)$title <- V(g)$name
set.seed(1)
coords <- qgraph.layout.fruchtermanreingold(
  as_edgelist(g, names = F), 
  weights=E(g)$value,
  vcount=vcount(g), 
  area=vcount(g)^2, 
  repulse.rad=vcount(g)^3
)
visIgraph(g) %>% 
  visEdges(width = "value", title="value", color = list(highlight="#ff0000", opacity = .8)) %>% 
  visIgraphLayout("layout.norm", layoutMatrix = coords)