ggplot火山图的绘制(volcano plot)

library(ggplot2)
volcano<-subset(data,select = c(Pvalue,Foldchange))
threshold<-as.factor((log2(volcano$Foldchange)>1.5|log2(volcano$Foldchange)<(-1.5))&volcano$Pvalue<0.05)
r03=ggplot(volcano,aes(log2(Foldchange),-log2(Pvalue),colour=threshold))+geom_point()
r04=r03+labs(title="Volcanoplot")+theme(plot.title = element_text(hjust = 0.5))+xlim(-10,10)
r05=r04+geom_vline(xintercept=c(-1.5,1.5),linetype="dotted",size=1)+geom_hline(yintercept=-log2(0.05),col="blue")

 

 


 

ggplot火山图的绘制(volcano plot)_第1张图片 火山图

用于绘制火山图的数据矩阵(节选)
基因名 Pvalue Foldchange
ENSG00000000003 0.868134121987662 1.2
ENSG00000000457 0.256006872721537 1.47826086956522
ENSG00000000971 0.932736306872995 0.961486486486487
ENSG00000001084 0.512134516499327 0.555555555555556
ENSG00000001167 0.175213431516265 0.291666666666667
ENSG00000001617 0.331530822974447 1.58441558441558
ENSG00000001630 0.407563817673791 0.588235294117647

 

 

 

 

 

你可能感兴趣的:(生物信息学基础分析)