Skip to content

Sankey Plot Node Positions are incorrect #4714

Open
@akhildevelops

Description

@akhildevelops

Describe your context

  • replace the result of pip list | grep dash below
dash                 1.5.1              
dash-core-components 1.4.0              
dash-html-components 1.0.1              
dash-renderer        1.2.0              
dash-table           4.5.0  

Describe the bug

Want to position Nodes along X-Axis in a Sankey Plot and Y to be automatically Adjusted. When I define X Positions only Sankey doesn't align the Nodes. But If I define Y Positions then only Sankey aligns the Nodes.

    def create_sankey_plot(self, source_r, target_r, value_r, colors_r,
                           labels_r, labels_a, colors_a):
        return go.Sankey(
            node=dict(
                pad=15,
                thickness=20,
                line=dict(color="black", width=0.5),
                label=labels_a,
                color=colors_a,
                x=[0.2, 0.1, 0.5, 0.7, 0.3, 0.5]
            ),
            link=dict(
                source=source_r,
                target=target_r,
                value=value_r,
                color=colors_r,
                line={'width': 1},
                label=labels_r
            )
        )

Above code will not align Nodes. Below code works:

def create_sankey_plot(self, source_r, target_r, value_r, colors_r,
                           labels_r, labels_a, colors_a):
        return go.Sankey(
            node=dict(
                pad=15,
                thickness=20,
                line=dict(color="black", width=0.5),
                label=labels_a,
                color=colors_a,
                x=[0.2, 0.1, 0.5, 0.7, 0.3, 0.5],
                y=[0.3, 0.3, 0.3, 0.3, 0.3, 0.3],
            ),
            link=dict(
                source=source_r,
                target=target_r,
                value=value_r,
                color=colors_r,
                line={'width': 1},
                label=labels_r
            )
        )

Expected behavior

Align Nodes if provided only X values / Y values making other default.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3backlogbugsomething broken

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions