Sankey diagrams: links pass through nodes instead of around them

The Sankey I’ve created has an output link go through its source node and an input link go through its target node, instead of around. See image below. Links from node J to node D pass through instead of around.

Sankey with undesired behaviour

Code used:

import plotly.graph_objects as go

sankey_data = go.Sankey(link={'source': [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 1, 1, 1, 1, 1, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4], 
                              'target': [2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 3, 3, 3, 3, 3, 8, 8, 8, 8, 8, 6, 6, 6, 6, 6, 9, 9, 9, 9, 9, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 6, 6, 6, 6, 6], 
                              'value': [11.166194444444445, 32.256194444444446, 6.79125, 26.99652777777778, 0.0, 5.691416666666667, 11.968416666666666, 3.42275, 7.648416666666666, 0.0, 11.166194444444445, 32.256194444444446, 6.79125, 26.99652777777778, 0.0, 3.783611111111111, 5.071111111111112, 1.90625, 2.6694444444444443, 0.0, 0.5596944444444445, 0.1471944444444444, 0.1175, 0.1815277777777777, 0.0, 1.29711066, 0.140356724, 1.879150455, 4.076354915, 6.966262547, 0.00140078, 0.00166618, 0.00408898, 0.053322942, 0.659548282, 1.29570988, 0.138690544, 1.875061475, 4.023031973, 6.306714265, 1.29570988, 0.138690544, 1.875061475, 4.023031973, 6.306714265, 0.057285199, 0.00023536, 0, 0, 1.00432117, 0.057285199, 0.00023536, 0, 0, 1.00432117], 
                              'label': ['Biomassa', 'Fossiel', 'Metalen', 'Mineralen', 'Onbekend/Gemengd', 'Biomassa', 'Fossiel', 'Metalen', 'Mineralen', 'Onbekend/Gemengd', 'Biomassa', 'Fossiel', 'Metalen', 'Mineralen', 'Onbekend/Gemengd', 'Biomassa', 'Fossiel', 'Metalen', 'Mineralen', 'Onbekend/Gemengd', 'Biomassa', 'Fossiel', 'Metalen', 'Mineralen', 'Onbekend/Gemengd', 'Biomassa', 'Fossiel', 'Metalen', 'Mineralen', 'Onbekend/Gemengd', 'Biomassa', 'Fossiel', 'Metalen', 'Mineralen', 'Onbekend/Gemengd', 'Biomassa', 'Fossiel', 'Metalen', 'Mineralen', 'Onbekend/Gemengd', 'Biomassa', 'Fossiel', 'Metalen', 'Mineralen', 'Onbekend/Gemengd', 'Biomassa', 'Fossiel', 'Metalen', 'Mineralen', 'Onbekend/Gemengd', 'Biomassa', 'Fossiel', 'Metalen', 'Mineralen', 'Onbekend/Gemengd']}, 
                        node={'label': ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J'],
                              'x': [0.0, 0.0, 0.2, 0.2, 0.4, 0.9, 0.9, 0.5, 0.8, 0.9],
                              'y': [0.0, 0.1, 0.1, 0.4, 0.6, 0.2, 0.6, 0.8, 0.8, 0.95],
                              'pad': 10}, 
                        arrangement='snap')

fig = go.Figure(sankey_data)
fig.show()

For reference, this toy example displays the right behaviour:

import plotly.graph_objects as go

fig = go.Figure(go.Sankey(
    arrangement = "snap",
    node = {
        "label": ["A", "B", "C", "D", "E", "F"],
        "x": [0.2, 0.1, 0.5, 0.7, 0.3, 0.5],
        "y": [0.7, 0.5, 0.2, 0.4, 0.2, 0.3],
        'pad':10},  # 10 Pixels
    link = {
        "source": [0, 0, 1, 2, 5, 4, 3, 5, 0, 0, 1, 2, 5, 4, 3, 5],
        "target": [5, 3, 4, 3, 0, 2, 2, 3, 5, 3, 4, 3, 0, 2, 2, 3],
        "value": [1, 2, 1, 1, 1, 1, 1, 2, 2, 3, 2, 2, 2, 2, 2, 3]}))

fig.show()

Sankey with desired behaviour

For instance, the link from node F to node A displays what I’d like to have.

As far as I can tell my code is about equivalent to the toy example, except for the actual values. I also checked that the relevant links in my own code flow in the right direction (source = J, target = D). I also played with the node positions to make sure there’s enough space for the link to do its thing. Changing the arrangement setting didn’t work either, and I couldn’t find any explicit settings for link behaviour in the docs. I thought it might be some versioning issue and that maybe the solver had changed, but both example Sankeys come from the same notebook.

I’m out of ideas, so any help would be appreciated!