circlize package: tracks with different number of sectors

113 Views Asked by At

I'm trying to make a circular diagram using the 'circlize' package in R. I want to make a plot with three tracks, outer track with 36 sectors, middle track with 12 sectors, and inner track with 3 sectors. The sectors in each track should be of equal size.

This code creates the outer track correctly:

sectors = 1:36
circos.par(gap.degree = 0, cell.padding = c(0, 0, 0, 0),
           start.degree = 360/20/2, track.margin = c(0, 0), clock.wise = FALSE)
circos.initialize(sectors, xlim = c(0, 1))

circos.track(ylim = c(0, 1), sectors = sectors,
             bg.col = rep(c("lightblue", "lightgreen", 'lightyellow'), 12), bg.border = "black", track.height = 0.1)

circos.trackText(x = rep(0.5, 36), y = rep(0.5, 36),
                 labels = c('A', 'B', 'C') %>% rep(12),
                 cex = 0.8, sectors = sectors, col = "black", font = 2, facing = "downward")

existing plot

However, when I try to start the middle 12-sector track with circos.track(ylim = c(0, 1), sectors = 1:12, it just defaults to using 36 sectors. How can I fix this? Thanks for any assistance.

0

There are 0 best solutions below