How to put rownames from original data into chord diagram.
The following link is for my dataset:
https://docs.google.com/spreadsheets/d/1HdjZvWvkt1YuFuqNaiCp9OvmhX1nRohqswkxroZVjW8/edit?usp=sharing
I tried the following code:
library(circlize)
library(readr)
df <- read_csv("chord_diag_final.csv", show_col_types = FALSE)
rownames(df) <- df[[1]]
df <- df[,-1]
print(rownames(df))
data <- as.matrix(df)
chordDiagram(as.data.frame(data), annotationTrack = "grid", preAllocateTracks = 1)
circos.trackPlotRegion(track.index = 2, panel.fun = function(x, y) {
xlim = get.cell.meta.data("xlim")
ylim = get.cell.meta.data("ylim")
sector.name = get.cell.meta.data("sector.index")
circos.text(mean(xlim), ylim[1] + 2.5, sector.name,
facing = "clockwise", niceFacing = TRUE, adj = c(0, 0.5), cex=0.6)
circos.axis(h = "top", labels.cex = 0.5, major.tick.percentage = 0.2,
sector.index = sector.name, track.index = 2)
}, bg.border = NA)
I got the following Diagram:
Instead of R1, R2, R3, i want the original rownames as labels for the sectors.
Thanks in advance!!