Reputation: 623
I am trying to plot a network using visNetwork. However, the edges are not being displayed. There is a very similar question in stackoverflow regarding this. But the solution mentioned there does not apply to my case. Any help would be great. The following are the the nodes and edges data set that need to be plotted.
why doesn't this visNetwork in R show edge
nodes_CTP
ID label
1 0 order
2 1 details
3 2 tab
4 3 displays
5 4 profile
6 5 window
7 6 status
8 7 sign
9 8 powerorders
10 9 detail
11 10 button
12 11 prerequisite
13 12 icon
14 13 prerequisites
15 14 chart
16 15 control
17 16 entry
18 17 encounter
19 18 change
20 19 verify
21 20 purpose
links_CTP
from to value
1 0 1 0.55
2 0 2 0.53
3 0 3 0.50
4 0 4 0.50
5 0 5 0.49
6 0 6 0.48
7 0 7 0.44
8 0 8 0.43
9 0 9 0.42
10 0 10 0.41
11 0 11 0.39
12 0 12 0.39
13 0 13 0.38
14 0 14 0.38
15 0 15 0.38
16 0 16 0.37
17 0 17 0.37
18 0 18 0.37
19 0 19 0.37
20 0 20 0.37
library(visNetwork)
visNetwork(nodes_CTP, links_CTP, height = "700px", width = "100%") %>%
visOptions(selectedBy = "label",
highlightNearest = TRUE,
nodesIdSelection = TRUE) %>%
visPhysics(stabilization = FALSE)
Upvotes: 1
Views: 2205
Reputation: 544
This work fine for me. Verify data format (class and names).
library(visNetwork)
nodes_CTP <- data.frame(id = 0:20, label = LETTERS[1:21])
links_CTP <- data.frame(from = 0, to = 1:20,
value = seq(0.35, 0.5, length.out = 20))
visNetwork(nodes_CTP, links_CTP, height = "700px", width = "100%") %>%
visOptions(selectedBy = "label",
highlightNearest = TRUE,
nodesIdSelection = TRUE) %>%
visPhysics(stabilization = FALSE)
Upvotes: 1