When creating a Sankey diagram in R, if I move my target nodes up/down, then the links themselves are moving along with the nodes.
In the image on the top right and the image on the bottom, the nodes have been moved around. However moving the order of the nodes has changed the link position themselves. Is there any way to fix the link position and with that, the colour of the links and nodes themselves? The sankey diagram on the top left is the desired output wanted.
Here's the code I am using:
library(networkD3) library(tidyverse) nodes = data.frame("name" = c("B1","B2","B3","B4","B5","B6")) links = as.data.frame(matrix(c( 0,1,20, 0,2,25, 0,3,15, 0,4,40, 0,5,30), byrow = T,ncol = 3 )) names(links) = c("source","target","value") sankeyNetwork(Links = links, Nodes = nodes, Source = "source", Target = "target", Value = "value", NodeID = "name", fontSize= 12, nodeWidth = 30)
Any help would be appreciated.