So I haven't found any clear solutions in the r documentation for the Sankey diagram, and hoping someone could help me! All I want to do is make the links the same color as the source node, and have the link darken when hovering above it. Here's my Sankey Diagram as it exists at the moment, unfortunately, I can't share the data as there are some confidentiality issues. At the bottom you'll find a link for the image of the plot that I have.
dt <- setDT(copy(dt_minors2016))
nodes <- dt[,unique(c(citizen,geo))]
sources <- match(dt[,citizen],nodes)-1
targets <- match(dt[,geo], nodes) -1
values <- dt[,V1]
fig <- plot_ly(
type = "sankey",
#default= 1000,
domain = list(
x = c(0,1),
y = c(0,1)
),
orientation = "h",
valueformat = ".0f",
valuesuffix = "Persons",
node = list(
label = nodes,
# color = colors,
pad = 15,
thickness = 15,
line = list(
color = "black",
width = 0.5
)
),
link = list(
source = sources,
target = targets,
value = values,
color = 'rgba(0,255,255,0.4)'
)
)
fig <- fig %>% layout(
title = "UAM asylum seekers from top 5 origin countries to EU countries - 2016",
font = list(
size = 10
),
xaxis = list(showgrid = F, zeroline = F),
yaxis = list(showgrid = F, zeroline = F),
hovermode = "x unified"
)
fig