I have a network where I characterized each of the nodes with the previous analysis and assigned colors as follows:
plot.igraph(g, layout=layout.fruchterman.reingold(g), vertex.color=node_colors, vertex.label = node_names)
The variable 'node_colors' is a vector that was made from the previous analysis, so the colors will match the placement / clustering of the vertices.

However, when I try to implement a personalized coloring scheme in networkD3, I get an "unused argument" error:
data<-igraph_to_networkD3(g, group = members) forceNetwork(Links = data$links, Nodes = data$nodes, Source = 'source', Target = 'target', NodeID = 'value', Nodesize = 'size', Group = "group", colourScale=node_colors, zoom = T, legend = T, opacityNoHover = TRUE)
Error: Warning: Error in ForceNetwork: unused argument (colorScale = node_colors)
NetworkD3 seems to just create its own coloring scheme ... so when I omit the argument: 'colorScale = node_colors', I get the following:

But, as you can see, the colors do not synchronize with the colors in the graphic.
Does anyone know how to create a personalized coloring scheme (a vector containing a number of colors) in networkD3
r igraph networkd3
johnny utah
source share