plot - R circlize: Error in circos.initialize -


i able follow circlize example in description of package on cran easily:

library('circlize') set.seed(123) mat = matrix(sample(1:100, 18, replace = true), 3, 6) rownames(mat) = letters[1:3] colnames(mat) = letters[1:6] ### basic settings par(mfrow = c(3, 2)) par(mar = c(1, 1, 1, 1)) chorddiagram(mat) 

however, when replace mat mymatrix error:

error in circos.initialize(factors = factor(cate, levels = cate), xlim = cbind(rep(0,  :    since `xlim` matrix, should have same number of rows length of level of `factors` , number of columns of 2. 

can explain why getting message? not see difference between mat , mymatrix other mymatrix larger:

      b   c   d   e   f   g   h     j   k   l   m   n   o   p   q   r   s   t   u   v   w   x   y   z   a2  b2  c2  d2   1060360.659 0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0 b   0   32143148.75 996976.8445 0   4944648.524 5688385.041 61990.5913  0   0   0   0   -1563.225   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   31922242.6 c   0   0   6342776.843 0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0 d   0   0   0   28617385.81 17842142.64 0   0   0   0   0   0   0   0   409444.5633 0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0 e   0   0   0   4990921.202 105686446.3 536246.2188 0   0   0   0   0   0   0   8587899.583 0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   378565.5746 f   0   92732.7741  0   4282.9319   33543553.89 36773976.59 1894761.93  0   0   333209.342  0   20739.0655  327956.7365 0   1022673.163 12229.0255  0   0   386112.1743 224039.3207 0   2395066.197 268247.2897 0   0   0   0   0   0   11926701.96 g   0   0   0   0   0   0   7753767.003 0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0 h   0   0   0   0   0   5184133.29  0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   462767.7374 0   0   0   8992223.296 0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0 j   0   0   0   0   0   0   0   0   0   1950552.642 0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0 k   0   0   0   0   891032.5584 0   0   0   0   0   520107.9821 0   0   0   0   0   0   0   0   0   0   0   0   0   0   26724.8402  0   0   0   418902.5203 l   0   0   0   0   32044317.54 28147.5693  0   0   0   0   0   5383919.293 0   489912.5412 0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   4559115.003 m   0   0   0   0   0   3125823.41  0   0   0   0   0   0   1738293.164 0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0 n   0   1053825.966 -8526.9758  1283429.314 60333051.34 2621812.931 -1130.1924  0   -779545.8004    8055145.684 918.8702    -379747.1919    -177.6205   298563606.5 -9316.8654  0   0   0   0   0   2631991.077 0   0   0   0   0   1107369.803 0   0   118812465 o   0   0   0   0   0   0   0   0   0   0   0   0   0   0   1500451.292 0   0   0   0   0   0   0   0   0   0   0   0   0   0   7432418.396 p   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0 q   0   0   1496058.76  0   -4056617.74 294503  0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   410.4   0   0   0   0   0   0   0   1765984767 

code

dd <- read.table(header = true, text = "  rn    b   c   d   e   f   g   h     j   k   l   m   n   o   p   q   r   s   t   u   v   w   x   y   z   a2  b2  c2  d2   1060360.659 0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0                  b   0   32143148.75 996976.8445 0   4944648.524 5688385.041 61990.5913  0   0   0   0   -1563.225   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   31922242.6                  c   0   0   6342776.843 0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0                  d   0   0   0   28617385.81 17842142.64 0   0   0   0   0   0   0   0   409444.5633 0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0                  e   0   0   0   4990921.202 105686446.3 536246.2188 0   0   0   0   0   0   0   8587899.583 0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   378565.5746                  f   0   92732.7741  0   4282.9319   33543553.89 36773976.59 1894761.93  0   0   333209.342  0   20739.0655  327956.7365 0   1022673.163 12229.0255  0   0   386112.1743 224039.3207 0   2395066.197 268247.2897 0   0   0   0   0   0   11926701.96                  g   0   0   0   0   0   0   7753767.003 0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0                  h   0   0   0   0   0   5184133.29  0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0                    0   0   0   0   462767.7374 0   0   0   8992223.296 0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0                  j   0   0   0   0   0   0   0   0   0   1950552.642 0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0                  k   0   0   0   0   891032.5584 0   0   0   0   0   520107.9821 0   0   0   0   0   0   0   0   0   0   0   0   0   0   26724.8402  0   0   0   418902.5203                  l   0   0   0   0   32044317.54 28147.5693  0   0   0   0   0   5383919.293 0   489912.5412 0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   4559115.003                  m   0   0   0   0   0   3125823.41  0   0   0   0   0   0   1738293.164 0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0                  n   0   1053825.966 -8526.9758  1283429.314 60333051.34 2621812.931 -1130.1924  0   -779545.8004    8055145.684 918.8702    -379747.1919    -177.6205   298563606.5 -9316.8654  0   0   0   0   0   2631991.077 0   0   0   0   0   1107369.803 0   0   118812465                  o   0   0   0   0   0   0   0   0   0   0   0   0   0   0   1500451.292 0   0   0   0   0   0   0   0   0   0   0   0   0   0   7432418.396                  p   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0                  q   0   0   1496058.76  0   -4056617.74 294503  0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   410.4   0   0   0   0   0   0   0   1765984767")  mymatrix <- as.matrix(dd[, -1]) rownames(mymatrix) <- dd[, 1] chorddiagram(mymatrix) 

in old version of circlize, matrix must of matrix class instead of data.frame, need convert data frame explicitly by:

mymatrix = as.matrix(a + b) 

in circlize, data frame data stored adjacency list (e.g first column group1, second column group2, third column strength of relation).

since read.table() returns data.frame class, in newer version of circlize, fine if matrix represents data frame. when data frame, chorddiagram() first check whether number of columns larger 3 , columns numeric. if so, converted matrix internally.


Comments

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

javascript - Get parameter of GET request -

javascript - Twitter Bootstrap - how to add some more margin between tooltip popup and element -