I have 3 categories (A, B, C) that repeat 3 times (A1, A2, A3, for A, and so forth). I'd like each of those 3 categories to have the same colour, so A is always blue across the 3 times it appears, B is always orange, C is always green. I'd also like that done with the links, with some gradient as it goes from one node to the next. Here's some R code to replicate what I'm getting:
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))
library(GoogleVis)
plot(gvisSankey(datSK, from="From",
to="To", weight="Weight",
options=list(sankey="{
link: { colorMode: 'gradient', colors: ['blue', 'orange', 'green']},
node: { colors: ['blue', 'orange', 'green']}}")))
The links and their gradients appear to work fine, but I can't figure out the logic behind the assignment of the colors for the nodes and links. Can it be explained so that I can determine how to apply the colours as described above?