3
totalReads=10000
mappedReads=8000
mappedTargetReads=6000
unmappedReads=totalReads-mappedReads
offtargetmappedReads=mappedReads-mappedTargetReads
data<-c(mappedReads,unmappedReads,mappedTargetReads,offtargetmappedReads)
round(data[1]/totalReads*100)->a
round(data[2]/totalReads*100)->b
round(data[3]/mappedReads*100)->c
round(data[4]/mappedReads*100)->d
pct<-c(a,b,c,d)
labels<-c("MappedReads","UnmappedReads","On-exon","Off-exon")
labels<-paste(labels,pct)
labels<-paste(labels,"%", sep="")
pie(c(mappedReads,unmappedReads,mappedTargetReads,offtargetmappedReads),labels=labels)

它基本上独立地绘制了所有四个切片。但是在这里mappedTargetReadsofftargetmappedReads是根据映射读取计算的,因此,我想细分mappedReads切片并表示mappedTargetReadsofftargetmappedReads在 内mappedReads

或者是否可以在一个 Rplot 中绘制两个不同的饼图?

4

1 回答 1

2

这会产生一个带有两个饼图的图:

par(mfrow = c(1,2))
pie(c(mappedReads,unmappedReads),labels=labels[1:2], main = "Global")
pie(c(mappedTargetReads,offtargetmappedReads),labels=labels[3:4],
    main = "MappedReads")

在此处输入图像描述

于 2012-10-28T10:05:57.643 回答