Dear Biostar users,
I am using ggbio to add a chromosome ideogram over data along the length of a chromosome. See the code beneath here for some sample code:
library(GenomicRanges) library(ggbio) data(hg19IdeogramCyto, package = "biovizBase") x <- seq(from=1,to=8e+07,by=100) x <- sample(x,7000) x <- append(x,x) y_ <- seq(from=-1,to=1,by=0.00001) y <- sample(y_,7000) y2 <- sample(y,7000) y <- append(y,y2) z <- NULL z[1:7000] <- 'one' z[7001:14000] <- 'two' df <- data.frame(x,y,z) p <- plotSingleChrom(hg19IdeogramCyto, "chr17",xlabel=TRUE,zoom.region=c(min(df$x),max(df$x))) p2 <- qplot(x,y,data=df,colour=z,geom='line') tracks(p, p2 = p2, heights = c(1.2, 5))
Which results in:
Issue one: the ideogram x axis seems out of place with the data x axis. How do I align these two, in such a way that the cytobands actually corresprond to x axis below?
Issue two: Where have my legends gone? In normal ggplot/qplot I would nicely get a legend with "one" and "two" on the right. Somehow this vanished?
Thanks a lot for any suggestions!