How to get rid of kinks in the bands between nodes? SankeyNetwork, NetworkD3 in R

49 Views Asked by At

I have relatively little experience with R, but have been using it recently to create Sankey diagrams. Specifically, I have been using the package/library NetworkD3 and then sankeyNetwork. I had got it looking just how I wanted:

Sankey I had

But then the values changed as a result of my project (different values flowing between nodes). And when I plugged in these new values, the connecting bands between nodes changed - adding in large kinks on two bands. Here is what it looks like now:

Sankey with kinks

Is there anyway to get rid of these kinks?

I've been unsuccessful searching for an answer on Google. One thought I had was to adjust the width, but at least how I was doing it (in the sankeyNetwork call) was unsuccessful.

I'd prefer to not post my values, but they are not subject to change. I'd like to change something in how networkD3 creates the bands to get back to these smooth, curved lines I originally had. Here is the sankeyNetwork call I use:

p <- sankeyNetwork(Links = links, Nodes = nodes, Source = "IDsource", target = "IDtarget", Value = "value", NodeID = "name", fontSize = 0, fontFamily = "serif", nodeWidth = 30, nodePadding = 30, width = 1300, height = 500, colourScale = color)

p

I'm hoping someone has come across this issue in the past and found a fix. Any thoughts are appreciated.

0

There are 0 best solutions below