简体   繁体   中英

how to increase the radius in circlize plot

I have drawn the following plot using the circlize package. The red circle is the unit circle drawn afterwards, using plotrix . I want to plot the first track outside the red unit circle. For this reason I changed canvas.xlim and canvas.ylim to c(-1.2, 1.2) . However, this does not work. Any ideas how to increase the circle radius for the circlize plot?

NOTE : Alternatively, it would be sufficient for me, if the tracks would be outside of the unit circle instead of inside.

在此处输入图片说明

library(circlize)
set.seed(2)
n = 10
a = data.frame(factor = "dummy",
               x = rnorm(n, 100, sd=10))
circos.par(track.height = 0.2,
           canvas.xlim=c(-1.2, 1.2),   # bigger canvas?
           canvas.ylim=c(-1.2, 1.2))   # bigger canvas?
circos.initialize(factors = a$factor, 
                  x = a$x, xlim = c(0, 360))

lim <- c(-1.2, 1.2)
plot(NULL, asp=1, xlim=lim, ylim=lim)
circos.trackHist(a$factor, a$x, col = "blue", bg.col = grey(.95))
plotrix::draw.circle(0,0,1, border="red", lwd=2)  # unit circle

I don't know how to adjust xlim and ylim to make two plots fit. But if you just want to put the red circle inside the track, you can use draw.sector() function directly:

circos.initialize(factors = a$factor, 
                  x = a$x, xlim = c(0, 360))
circos.trackHist(a$factor, a$x, col = "blue", bg.col = grey(.95))
draw.sector(0, 360, rou1 = circlize:::get_most_inside_radius(),
    border = "red")

Here circlize:::get_most_inside_radius() returns the distance between the bottom border of the last track to the center of the circle.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM