Hi all,
I'm making a chord diagram in R, and have question on assigning color. You can easily replicate with my code below. What I'm trying to do is to assign two different color in same section.
set.seed(999)
mat = matrix(sample(18, 18), 3, 6)
rownames(mat) = paste0("S", 1:3)
colnames(mat) = paste0("E", 1:6)
col_mat = rand_color(length(mat), transparency = 0.5)
dim(col_mat) = dim(mat)
chordDiagram(mat, grid.col = grid.col, col = col_mat)
If you run my code, I get value of 8 for E4 of the column and S2 of the row, and plot shows only single flow with single color. What I want to do here is to seperate them into two colors (e.g. black and yellow) in order to show even though they belong to same pair (E4-S2), they are originated from different location (e.g. E4(from US)-S2 -- Black, E4(from Russia)-S2 -- Yellow).
Any brilliant idea to show this would be welcome! Thank you in advance
Something like this ?
Thank you for the comment! Not like this assigning color in grid. I want to color differently their links.
In your example there is no information about this sub category you are mentioning using country names. The best would be to redesign your colnames with your country names, assigning each country a color and show country groups (E1, E2...) using
highlight.sector