Chord diagram is an unique and effective way to visualize relationships and flows.
The circlize package developed by Zuguang Gu enables drawing chord diagram in a relatively easy way.
First need to install and load circlize package.
library(circlize)
Now create a matrix. Each column labels and row labels of this matrix will become a node in the diagram. And column and row labels will each take up half of the circle
mat = matrix(1:20, 4, 5)
rownames(mat) = paste0("Q", 1:4)
colnames(mat) = paste0("Area", 1:5)
Then use chordDiagram command for a quick plot.As the color is randomly generated, we could use set.seed() to get a consistent result
set.seed(685)
circos.par(cell.padding = c(0, 0, 0, 0))
chordDiagram(mat, order = c("Q1", "Q2", "Q3", "Q4", "Area1", "Area2", "Area3", "Area4", "Area5"))
circos.clear()