0

I've made a sankey diagram to illustrate the change of a conclusion after an index event. The conclusion is noted as "Normal", "Borderline", or "Abnormal". I have changed the nodes of the diagram to reflect the conclusion by giving them either the color green, yellow or red. I would want to make the link from normal to borderline have gradient colour from green to yellow.

I managed to colour the different links between groups with a colour (e.g. from normal to borderline is yellow) by creating a vector called links$group and assigning a colour to the type of link (e.g. type_b is the link between normal to borderline and giving it a colour using the following function:

my_color <- 'd3.scaleOrdinal() .domain(["a", "b", "c", "type_a", "type_b", "type_c", "type_e"])
                                .range(["#9ACD32", "#FFD700", "#FF4500", "#CCCCCC", "#FFD700", "#FF4500", "#FF4500"])'

This is informative but a little hard on the eyes. I think i need to use the RColorBrewer"package. I made the following code:

type_b_color <- ramp <- colorRamp(c("#9ACD32", "#FFD700"))

and asigned it in the previous code as follows:

my_color <- 'd3.scaleOrdinal() .domain(["a", "b", "c", "type_a", "type_b", "type_c", "type_e"])
                                .range(["#9ACD32", "#FFD700", "#FF4500", "#CCCCCC", "type_b_color", "#FF4500", 

This does however remove the color completely instead of letting it be gradient from the normal node (green) to the borderline node (yellow).

0 Answers0