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)
其中基本上独立地绘制了所有四个切片。但是这里mappedTargetReads
,offtargetmappedReads
是根据映射的读数进行计算的,因此,我想细分mappedReads
切片,并在mappedTargetReads
,offtargetmappedReads
中表示{ {1}}。
或者是否可以在一个Rplot中将两个不同的饼图彼此相邻?
答案 0 :(得分: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")