I created a Sankey Plot using the NetworkD3 R package. Below is an example of the output:
I used the following code for the Sankey:
sankeyNetwork(Links = SankeyLinks, Nodes = SankeyNodes, Source = "source",
Target = "target", Value = "value", NodeID = "names",
fontSize = 14, nodeWidth = 20,nodePadding = 15,NodeGroup = "nodeColor",
colourScale = JS(ColourScale), LinkGroup = "linkColor",
sinksRight = T)
The network generates text labels to the right of the middle nodes, which crowds the links to the leaf nodes. I would like to switch the text to the left side of the inner nodes without changing the text placement on the beginning node and leaf nodes (right and left, respectively).
I have researched a similar question: Place text values to right of sankey diagram
Here is another: How to place node title to the left or right of the node in d3 Sankey graph?
The answers are coded in D3.js, which I have not yet learned and don't know how to implement into my R code, or they are moving text labels to the right of the nodes.
Any suggestions that I can implement into R to move text of the inner nodes to the left would be greatly appreciated!
Edit: Using the example code given in the comment, when I use the set.seed it doesn't create inner nodes, so maybe that is the issue? Output Example