I am working on manually changing the color of the bars in a sankey diagram, but for the last three categories, the colors do not vary according to the new color_scale and "yellow" is assigned to all of the three last categories.
'''
color_scale <- 'd3.scaleOrdinal().
range(["gainsboro","dimgray", "black" ,
"darkred","red","tomato", "lightsalmon",
"royalblue","blue", "midnightblue", "deepskyblue",
"yellow", "green","red"])'
sankeyNetwork(Links = resparking$links, Nodes = resparking$nodes, Source = "source",
Target = "target", Value = "value", NodeID = "name",
units = "Number of Houses",
fontSize = 20, nodeWidth = 30,
colourScale = JS(color_scale))
'''
The data can be downloaded here: https://drive.google.com/file/d/1hPq-PvW89hsVylrLA0anqDFB-OrjBJIz/view?usp=sharing
The graph and data look like this: [enter image description here][1] [1]: https://i.stack.imgur.com/2EqAF.png