我有一个 8x8 邻接矩阵,如下所示:
我只需要可视化我的和弦图中的一些链接,保留所有 8 个扇区。我试图重现此处提供的说明:R Circlize, Chord graph with empty sector
所以我编码:
library(circlize)
mat <- read.table("/home/myself/Documents/matrix1.txt", header=TRUE)
col = c("#B96927","#3E647D","#7B92A8","#82C0E9","#2D6D66",
"#BFA19C","#0088BC","#97B6B0")
col[3, 3] = "#FFFFFF00"
chordDiagram(as.matrix(mat), symmetric = TRUE, col = col)
circos.info()
但是,我收到以下错误
第一个错误:
> col[3, 3] = "#FFFFFF00"
Error in col[3, 3] = "#FFFFFF00" :
incorrect number of subscripts on matrix
第二个错误:
> chordDiagram(as.matrix(mat), symmetric = TRUE, col = col)
Error in if (nrow(value) == length(rn) && ncol(value) == length(cn)) { :
missing value where TRUE/FALSE needed
我怎样才能解决这个问题?任何帮助将不胜感激。谢谢。