我想用CNV输出来绘制CNV,但是我发现染色体的名字在图片的顶部,我怎么能把染色体的名字移到底部。下面是我用来绘制CNV的代码:
data = read.table('/Users/andy/Desktop/plot_R/17A020980.sorted.cnr', head=T, sep='\t', check.names = F)
data$chromosome = factor(data$chromosome, levels=c(paste0('chr', 1:22), 'chrX', 'chrY'))
p = ggplot(data, aes(start, 2*2^data$log2, color=chromosome)) +geom_point()+scale_x_discrete(breaks=NULL)+theme_minimal()+theme(legend.position="none")+xlab(NULL)+facet_grid(.~chromosome, scale="free"))
p + scale_y_continuous(name="Copy Number", limits = c(0,8))结果显示在这个图片中。
发布于 2020-03-22 10:40:33
在facet_wrap()或facet_grid中使用facet_grid。试试这个:
ggplot(mtcars, aes(hp, mpg)) +
geom_point() +
facet_grid(.~cyl, switch = "x")https://stackoverflow.com/questions/60797864
复制相似问题