I want to create a sankey that describes whether people are retained in care, lost to follow up, died or censored at each year after they started treatment. I have created the diagram but the buckets at each time point get larger/ taller from left to right.
This is my code:
ret_pharm_sankey_5yearall <- sankeyNetwork(Links = retention_pharm_sankey_5yrall_df, Nodes = retention_nodes,
Source = "IDsource", Target = "IDtarget",
Value = "time_year", NodeID = "name",
colourScale = my_colour,
LinkGroup = "group",
NodeGroup="group",
iterations = 0, #this uses the order in nodes dataframe
sinksRight=FALSE)
What I want: I want it to remain a constant height, reflecting the consistent number of individuals, over time What I've tried:
- I have tried setting sinksRight to true/false and it doesnt help.
- tried this from chat gpt:
# Add CSS styling to set constant height
ret_pharm_sankey_5yearall <- onRender(ret_pharm_sankey_5yearall, '
function(el, x) {
d3.select(el).select("svg").style("height", "500px");
}
')
What I get: Sankey diagram of RIC
If more helpful to see it visually, i want the Sankey to be a consistent width representing a constant number of people, like this: example of what I want the Sankey to look like
instead of this: Sankey diagram of RIC that I produce (which starts small and grows larger, despite containing a consistent number of individuals at each time point)