从 Plotly Sankey 图中提取 X 和 Y 坐标

Obe*_*bed 5 r plotly sankey-diagram

Plotly 在哪里存储节点的 X 和 Y 坐标(或 XY 坐标的 Plotly 等效项)?特别是当类型=“sankey”时。

例如:

library(plotly)
fig <- plot_ly(
    type = "sankey",
    orientation = "h",
    node = list(
      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(8,4,2,8,4,2)
    )
  )

fig <- fig %>% layout(
    title = "Basic Sankey Diagram",
    font = list(
      size = 10
    )
)
fig
Run Code Online (Sandbox Code Playgroud)

在此输入图像描述

如何找到 Plotly 分配给 A1、A2、B1、B2、C1 和 C2 的 X 和 Y 坐标?我想做的是将节点名称及其坐标提取到新的数据框中。