I try to create a sankey diagram using the Riverplot package in R with fixed node and edge colors. The colors are given in separate colors in the .csv files
library(riverplot)
# import data
edges = read.csv("sankey_data_edges.csv")
nodes = read.csv("sankey_data_nodes.csv")
r <- makeRiver(nodes, edges)
plot( r )
sankey_data_nodes.csv contains:
ID x labels y col
1 1 G1 2 green
2 1 G2 1 red
3 3 G3 3 red
4 3 G4 2 red
5 1 G5 6 red
6 1 G6 5 red
7 4 G7 6 red
8 2 G8 4 red
9 1 G9 3 red
10 1 G10 4 red
11 3 G11 6 red
12 3 G12 4 red
sankey_data_edges.csv contains:
N1 N2 Value col edgecol
5 4 0.098870056 yellow col
1 11 0.124105534 red col
5 3 0.163841808 red col
2 11 0.175207813 red col
10 8 0.214996976 red col
5 12 0.330508475 red col
5 11 0.406779661 red col
9 8 0.485689676 red col
8 11 0.700686653 red col
11 7 1 red col
6 11 1 red col
Unfortunately the result is not what it should be according to the set colors:
Errors:
- No green node (ID=1)
- Edges are black instead of red and one yellow