Given a dataset, how can I see a node that belongs to different groups, have different colors when they are selected?
Ex:
nodes <- data.frame(id = 1:15, label = paste("Label", 1:15),
group = sample(LETTERS[1:3], 15, replace = TRUE))
edges <- data.frame(from = trunc(runif(15)*(15-1))+1,
to = trunc(runif(15)*(15-1))+1)
nodes$group <- sample(c("group 1", "group 2", "group 1, group 2, group 3"),
nrow(nodes), replace = TRUE)
visNetwork(nodes, edges) %>%
visOptions(selectedBy = list(variable = "group", multiple = TRUE))
How can I give a different color to a node when we select Group 1 and another color when selected for Group 2?
My goal is to be able to select group 1, and node 1 will be X color; and when I select group 3, node 1 will be Y color.
New visualization