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.