是否有可能调整visNetwork的选项(例如visLayout,visOptions或visPhysics),以获得一个网络的可视化,类似于一个心智图?心智图状布局(网络可视化使用vis.js JavaScript库)
而这里使用visNetwork
得出相同的数据在R
我重复的例子:
nodes <- structure(list(id = 1:22, label = structure(c(14L, 20L, 19L,
16L, 12L, 18L, 2L, 17L, 22L, 8L, 13L, 3L, 4L, 5L, 6L, 7L, 21L,
15L, 9L, 1L, 10L, 11L), .Label = c("A seemengly impossible mission\n",
"Another \n", "Detail 1\n", "Detail 2\n", "Detail 3\n", "Detail 4\n",
"Detail 5\n", "Do you know where is Dover?\n", "Dover Castle\n",
"Finally, I'm the fifth\n", "I'm alone", "I'm relatively short\n",
"Let's say there is a third one\n", "Main topic\n", "Operation Dynamo\n",
"or, I'm even longer and perhaps I need some more space\n", "Running out of imagination\n",
"Shorter\n", "Some longer text goes here\n", "Thing 1\n", "Thing number 4\n",
"What can happen?\n"), class = "factor"), shape = structure(c(1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L), class = "factor", .Label = "box")), .Names = c("id",
"label", "shape"), row.names = c(NA, -22L), class = "data.frame")
edges <- structure(list(from = c(1L, 2L, 2L, 2L, 2L, 1L, 7L, 7L, 7L, 1L,
11L, 11L, 11L, 11L, 11L, 1L, 17L, 17L, 17L, 1L, 21L), to = 2:22,
arrows = structure(c(1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L), .Label = "to", class = "factor")), .Names = c("from",
"to", "arrows"), row.names = c(NA, 21L), class = "data.frame")
library(visNetwork)
visNetwork(nodes, edges) %>%
visOptions(highlightNearest = TRUE, nodesIdSelection = TRUE) %>%
visLayout(randomSeed = 1)
这段代码产生这样的可视化:
所以你可以看到第一个数字更清晰,更易于阅读和使用。是否可以调整visNetwork
参数(vis.js参数)以使结果与此处的第一个数字相似?
基本上它是像具有中央主主题,然后围绕主主题径向布置下一级的主题,并且在彼此(种类列表)放样了进一步的水平。
也许看看'radialNetwork()'从[networkD3](https://christophergandrud.github.io/networkD3/)封装 –