- 使用R语言作图,下载ggpubr、ggthemes两个包。但这2个包需要下载Rtools,Rtools下载在官网下载适合自己电脑配置的即可,注意设置环境变量(设置2个,不然会报127、1这2个错)
- 作图前需要准备好数据,火山图需要adj.P.Val,logFC.
- 代码分享:
deg.data<-read.table("DEGdata.txt",header=T,sep="\t")
head(deg.data)
deg.dataadj.P.Val)
ggscatter(deg.data,x="logFC",y="logP")+theme_base()
deg.dataadj.P.Val>0.01,'NoDiff', ifelse(deg.datalogFC<= -2,'Down','NoDiff')))
ggscatter(deg.data,x="logFC",y="logP",color ="change" ,palette = c("#2f5688","#BBBBBB","#CC0000"),size = 1,repel = T,xlab = "logFC" ,
ylab = "-log10(adj.P.Val)")+theme_base()+geom_hline(yintercept = 1.30,linetype="dashed")+geom_vline(xintercept = c(-2,2),linetype="dashed")