Hi there,
I’m trying to plot a sankey diagram, but it’s generated blank.
Following is my code:
p <- plot_ly(
type = "sankey",
domain = c(
x = c(0, 1),
y = c(0, 1)
),
orientation = "h",
node = list(
label = c("Alarm 103", "Alarm 23", "Alarm 30", "Alarm 71", "Alarm 91", "Model 0M", "Model MA", "Model MC", "Model ML", "Model MX", "Model S3", "Model S7", "Serie 0", "Serie 2", "Serie 3", "Serie 4", "Serie 5" ),
color = c("#377EB860", "#377EB860", "#377EB860", "#377EB860", "#377EB860", "#E41A1C60", "#E41A1C60", "#E41A1C60", "#E41A1C60", "#E41A1C60", "#E41A1C60", "#E41A1C60", "#4DAF4A60", "#4DAF4A60", "#4DAF4A60", "#4DAF4A60", "#4DAF4A60"),
pad = 5,
thickness = 10,
line = list(
color = "black",
width = 0.5
)
),
link = list(
source = c(0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 10, 10, 10, 11, 11, 11, 11),
target = c(5, 6, 7, 8, 9, 5, 6, 8, 9, 5, 6, 7, 8, 9, 5, 6, 7, 8, 5, 6, 7, 8, 0, 3, 0, 1, 2, 4, 0, 1, 2, 3, 4, 0, 1, 2, 3, 4, 0, 1, 2, 3, 4, 0, 1, 2, 0, 1, 2, 4),
value = c(31, 23, 20, 394, 4, 2, 27, 295, 4, 232, 266, 330, 340, 2, 3, 57, 21, 257, 1, 3, 19, 564, 28, 3, 10, 11, 22, 64, 67, 68, 116, 221, 128, 190, 135, 180, 68, 242, 107, 60, 581, 46, 133, 3, 4, 108, 67, 50, 163, 20)
)
) %>%
layout(
title = "Basic Sankey Diagram",
font = list(
size = 10
)
)
Any help is greatly appreciated!