Picking up on this question, I'm trying to assign a set of colours to nodes, and hopefully links with the gradient mode, in a Sankey chart using GoogleVis package in R. The issue is that I have the same categories in each of the 3 sets of nodes, and I'm having trouble getting it to cooperate.
datSK <- data.frame(From=c(rep("A1",3), rep("B1", 3), rep("C1", 3), rep("A2", 3), rep("B2", 3), rep("C2",3)),
To=c(rep(c("A2", "B2", "C2"), 3), rep(c("A3", "B3", "C3"), 3)),
Weight=c(5,7,6,2,9,4,3,4,5))
I want nodes A, B, C, which appear in 3 different parts of the chart to have the same colors (respectively blue, orange, green).
plot(gvisSankey(datSK, from="From",
to="To", weight="Weight",
options=list(sankey="{
link: { colorMode: 'gradient', colors: ['blue', 'orange', 'green']},
node: { colors: ['blue', 'orange', 'green']}}")))
Unfortunately, I can't figure out how the colours are being assigned.