How to color groups in networkD3's sankeyNetwork?

Viewed 3476

My nodes consists of names and groups yet I can't seem to implement distinct colors for groups in my sankey diagram. The colors are either all blue with defaults or all black using the code below.

Here's the code I use:

sankeyNetwork(        
Links = data$links,
Nodes = data$nodes,
Source= "source",
Target = "target",
Value = "weight",
NodeID = "names",
fontSize = 15,
NodeGroup = "group" 
))

Here's the output I'm getting: enter image description here

2 Answers
Related