我使用 visNetwork 来可视化我的网络。下面是代码(借自 visNetwork cran 页面)。我的问题是:
- 我不会显示顶点和边缘标签。如何从可视化中删除它?
- 我想在单击节点时显示节点信息。当我单击任何节点和边时,似乎显示了数据标题列中的任何内容。标题是点击信息显示的“保留”列名吗?
- 当我点击任何节点时,我几乎看不到任何东西。如何更改点击显示的字体?非常感谢。
library(igraph)
library(visNetwork)
nodes <- data.frame(id = 1:10,
label = paste("Node", 1:10),
group = c("GrA", "GrB"),
value = 1:10,
shape = c("square", "triangle", "box", "circle", "dot", "star",
"ellipse", "database", "text", "diamond"),
title = paste0("<p><b>", 1:10,"</b><br>", paste("Node", 1:10),"</p>"),
color = c("darkred", "grey", "orange", "darkblue", "purple"),
shadow = c(FALSE, TRUE, FALSE, TRUE, TRUE))
edges <- data.frame(from = sample(1:10, 8), to = sample(1:10, 8),
label = paste("Edge", 1:8),
length = c(100,500),
arrows = c("to", "from", "middle", "middle;to"),
dashes = c(TRUE, FALSE),
title = paste("Edge", 1:8),
smooth = c(FALSE, TRUE),
shadow = c(FALSE, TRUE, FALSE, TRUE))
g <- graph_from_data_frame(d = edges, vertices = nodes)
visIgraph(g)