How to create a Sankey Diagram? (maybe using D3.js?)

Thank you very much for the implementation of the R code.
Works very easily. Not the fastest, but works.
Thanks!

Just for future reference, I leave copy in the post of the R code you had used:

library(networkD3)
library(tidyverse)

nodes <- tibble(`name`=c("A","B", "C", "D"))
links <- tribble(
    ~`source`, ~`target`, ~`value`,
    0, 1, 10,
    0, 2, 20,
    1, 3, 30,
    2, 3, 40)
    
sankeyNetwork(Links = links, Nodes = nodes,
              Source = "source", Target = "target",
              Value = "value", NodeID = "name",
              fontSize= 12, nodeWidth = 30)
3 Likes