Skip to content

Sankey Plot: Node position not working #1651

@SteEcker

Description

@SteEcker

Hi I'm using RStudio and plotly (4.8) to generate some interactive graphs.

I'm having issues with initializing the node positions for Sankey plots (https://plot.ly/r/reference/#sankey-node-x).
The nodes stay in the same place regardless if I specify x/y positions or not.
Tested it in python and there it woked like intended. Am I missing something?

pt <- plot_ly(
    type = "sankey",
    arrangement = "freeform" ,

    node = list(
      x = c(0.1, 1, 0.24, 0.7, 0.8, 0.9),
      y = c(0, .2, .3, .4, .5, .6),
      label = c("A1", "A2", "B1", "B2", "C1", "C2"),
      color = c("blue", "blue", "blue", "blue", "blue", "blue"),
      pad = 15,
      thickness = 20,
      line = list(
        color = "black",
        width = 0.5
      )
    ),

    link = list(
      source = c(0, 1, 0, 2, 3, 3),
      target = c(2, 3, 3, 4, 4, 5),
      value =  c(2, 3, 3, 4, 4, 5)
    )
  ) %>% 
  layout(
    title = "Basic Sankey Diagram",
    font = list(
      size = 10
    )
)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions