Open NevilHopley opened 6 years ago
One thing I have learned while using sankeyNetwork from netorkD3 is node orders (Y axis) is preserved when number of iterations =0. I tried your code with iterations = 0 and seems it preserve the specified NodePosX argument as well.
I know I'm three years late but maybe this helps:
0
value which will lead to problemsNodePosX = "xpos"
only works in combination with align = "none"
or align = "left"
nodes <- data.frame(
name = c("Enrolled", "Opted-Out", "Invited", "Activated"),
xpos = c(0, 1, 2, 5)
)
links <- data.frame(
source = c(0, 0, 2, 1),
target = c(1, 2, 3, 3),
value = c(20, 80, 80, 20)
)
sankeyD3::sankeyNetwork(
Links = links,
Nodes = nodes,
Source = "source",
Target = "target",
Value = "value",
NodeID = "name",
fontSize = 12,
NodePosX = "xpos",
align = "none"
)
Created on 2021-12-22 by the reprex package (v2.0.1)
I have been using the sankeyD3 package to create SankeyNetworks and the 'NodePosX' feature isn't working for me yet.
To help illustrate the similar problem that I am having, I have edited the example from akraemer007 that was posted here to include the X positions of the nodes (see below) but it's still not working in the way that he had originally wanted, with manual control over the x-position of the 'Opted-Out' node.
Can someone please help identify the issue that I'm missing? Thank you Nevil