简体   繁体   English

如何增加圆形图中的半径

[英]how to increase the radius in circlize plot

I have drawn the following plot using the circlize package.我使用circlize包绘制了以下图。 The red circle is the unit circle drawn afterwards, using plotrix .红色圆圈是之后绘制的单位圆,使用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) .出于这个原因,我将canvas.xlimcanvas.ylim更改为c(-1.2, 1.2) However, this does not work.但是,这不起作用。 Any ideas how to increase the circle radius for the circlize plot?任何想法如何增加对圆半径circlize情节?

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.我不知道如何调整xlimylim以使两个图适合。 But if you just want to put the red circle inside the track, you can use draw.sector() function directly:但是如果你只是想把红色圆圈放在轨道里面,你可以直接使用draw.sector()函数:

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.这里circlize:::get_most_inside_radius()返回最后一条轨道的底部边界到圆心的距离。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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