1

I have drawn the following plot using the circlizepackage. 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.

enter image description here

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
rawr
  • 20,481
  • 4
  • 44
  • 78
Mark Heckmann
  • 10,943
  • 4
  • 56
  • 88

1 Answers1

1

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.

Zuguang Gu
  • 1,301
  • 7
  • 11
  • SO now has a [`circlize`](http://stackoverflow.com/tags/circlize/info) tag for your convenience! – rawr Apr 11 '16 at 12:56