I am using networkD3 to create sankey diagrams in R. I am using something like below to generate the diagrams:
sankeyNetwork(Links = data$links, Nodes = data$nodes,
Source = "source", Target = "target", Value = "value", NodeID = "name",
units = "Questions", fontSize = 12, nodeWidth = 10,
colourScale = "d3.scale.category10()",
LinkGroup = "type", #<--assign colors to links
width = 1000, height = 600)
I am using LinkGroup = "type"
to color the links, where the type
is basically the source node's name. This makes the link color same as source node color. This is working pretty well.
I was wondering if there is anyway a gradient of color can be created from sources to targets for the associated links?