Reputation: 11431
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
Upvotes: 1
Views: 1044
Reputation: 1321
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.
Upvotes: 1