This data is a subset of a larger set of data in which I want to see sequential flows to the same event (node). It seems however, that there can be a maximum of three nodes with the same label - is this a known feature?
require(plotly)
json_data <- list(
link = list(
source=0:4,
target=1:5,
value=c(71415, 23568, 9328, 4159, 2065)
),
node =list(
label=c("C", "C", "C", "C", "C", "C"),
color=c("#4DAF4A", "#4DAF4A", "#4DAF4A", "#4DAF4A", "#4DAF4A", "#4DAF4A")
)
)
p <- plot_ly(
type = "sankey",
domain = c(
x = c(0,1),
y = c(0,1)
),
orientation = "h",
valueformat = ".0f",
valuesuffix = "",
node = list(
label = json_data$node$label,
color = json_data$node$color,
pad = 15,
thickness = 15,
line = list(
color = "black",
width = 0.5
)
),
link = list(
source = json_data$link$source,
target = json_data$link$target,
value = json_data$link$value
)
) %>%
layout(
title = "Flow length should be 6, but only shows 3",
font = list(
size = 10
),
xaxis = list(showgrid = F, zeroline = F),
yaxis = list(showgrid = F, zeroline = F)
)
p
I am able to get around this by using spaces around the labels as follows in the node definition
label=c(“C”, “C”, “C”, "C ", "C ", "C ")