I am making some sankey diagrams using R’s networkD3 package. I have an application that produces different sankey diagrams based on inputs the user sets. I know there is a maximum number of nodes that might display in any one diagram, but sometimes, depending on the inputs, less than the maximum number of nodes will display. I’d like the colors for the nodes to be consistent from one diagram to the next. (i.e. Node 0 should always be red, Node 3 should always be blue, etc…)
If I use the defaults in the package for coloring then this doesn’t occur and I am trying to figure out how to fix a custom color to each unique node.