1

I'm trying to use the circlize package to create a circos plot in which the outer track has unique sector names (10 names), and within each unique sector, there are 2 categories of file types. The two categories are the same for each of the 10 names (end-goal is to show, through directional links, which files were combined when converting file types).

Here is a simplified version of my code so far, which produces the larger track along with an inner track that shows what I am trying to do (but the "FileType1" and "FileType2" should be in two separate sectors to allow links to and from each).

library(circlize)

fileFrom <- paste0("Category", LETTERS[1:10])

f1 = factor(fileFrom)
  circos.initialize(factors = f1, xlim = c(0,1))


  # create main track (10 categories)
  circos.track(ylim = c(0,1), 
               panel.fun = function(x, y) {
                           sector.index = get.cell.meta.data("sector.index")
                           xcenter = get.cell.meta.data("xcenter")
                           ycenter = get.cell.meta.data("ycenter")
                           circos.text(xcenter, ycenter, 
                                       sector.index, 
                                       niceFacing = TRUE,
                                       cex = 1.3,
                                       facing = "bending.inside")
               }
  )

  # create ICARTT/netCDF track
  f2 <- factor(rep(c("ICARTT","netCDF"), 5)) # list of labels
  circos.track(ylim = c(0, 1), factors = f1, track.height=0.1,
               panel.fun = function(x, y) {
                           name = "FileType1   FileType2"
                           xcenter = get.cell.meta.data("xcenter")
                           ycenter = get.cell.meta.data("ycenter")
                           circos.text(xcenter, ycenter, 
                                      niceFacing = TRUE,
                                      labels=name,
                                      cex=0.6,
                                      facing = bending.inside)} 
               ) 

The second track only accepts factors that already exist, so I tried initializing the plot with all 12 categories and only calling the ones relevant to each track, but that left holes in the plot.

I am not sure whether there can be "true" sectors for more than one track, so I tried making either the outer of the inner track a "highlight" (based on this question), but it seems the identical factor names are tripping me up (ending up with a plot of only two sectors).

I also considered combining two separate plots, mentioned in section 6.3 of the circlize book, but I still wouldn't know how to create separate sectors with the same name. I am also not sure how to specify the link sources and destinations (sector.numeric.index maybe?)

Thanks in advance for any help.

Zoey RW
  • 185
  • 1
  • 15
  • How about using the combination of "Category" and "Filetype" as a unique sector? like "CategoryA-FileType1"? – Zuguang Gu Oct 31 '17 at 11:18
  • @ZuguangGu Thanks for the reply. I tried to do that, making the inner sectors unique factors and just repeating the name labels, but I still don't know how to have the outer track use a different set of factors (10 instead of 20). – Zoey RW Oct 31 '17 at 14:16
  • If you only want to add labels for the "10 categories", maybe you can check http://zuguang.de/circlize/example/grouped_chordDiagram.html, the most outside track (the car brand track) – Zuguang Gu Nov 02 '17 at 20:44

0 Answers0