This is a more general question to this: VisNetwork from IGraph - Can't Implement Cluster Colors to Vertices
I have an igraph that I have converted to a visNetwork:
library(visNetwork)
visIgraph(igraph, idToLabel = TRUE, layout = "layout_nicely")%>%
visNodes(size = 10) %>%
visOptions(highlightNearest = TRUE,
nodesIdSelection = TRUE)
I have a list of colors corresponding to the nodes that I want to color the graph with:
The colors are as follows:
c("#80FF00FF" "#FF0000FF" "#FF0000FF" "#00FFFFFF" "#FF0000FF" "#8000FFFF" "#FF0000FF" "#FF0000FF" "#FF0000FF" "#FF0000FF")
How do I add these colors to the nodes of the visNetwork?
It works in a normal plot if I were to do but not in visNetwork:
V(igraph)$color <- c("#80FF00FF" "#FF0000FF" "#FF0000FF" "#00FFFFFF" "#FF0000FF" "#8000FFFF" "#FF0000FF" "#FF0000FF" "#FF0000FF" "#FF0000FF")
plot(igraph)
Thanks
(If you want to have the reproducible code please refer to the link I mentioned at the top of the post.)