ggplot2绘制富集分析柱状图

library("ggplot2")
pathway=read.table("COS3_kegg_total.xls",header=T,sep="\t")
pathbar = ggplot(pathway,aes(x=Pathway,y=-1*log10(Pvalue)))
pathbar + geom_bar(stat="identity")
pathbar + geom_bar(stat="identity") + coord_flip()
pathbar+geom_bar(stat="identity",color="red",fill="blue")+coord_flip()
pathbar+geom_bar(stat="identity",aes(fill=-1*log10(Pvalue)))+coord_flip()
porder=factor(as.integer(rownames(pathway)),labels=pathway$Pathway)
pathbar+geom_bar(stat="identity",aes(x=porder,fill=-1*log10(Pvalue)))+coord_flip()
pathbar+geom_bar(stat="identity",aes(x=rev(porder),fill=-1*log10(Pvalue)))+coord_flip()
porder=factor(as.integer(rownames(pathway)),labels=rev(pathway$Pathway))
pathbar+geom_bar(stat="identity",aes(x=rev(porder),fill=-1*log10(Pvalue)))+coord_flip()
pqbar=pathbar+geom_bar(stat="identity",aes(x=rev(porder),fill=-1*log10(Pvalue)))+coord_flip()+theme(legend.position="none")+labs(title="Top20 of pathway enrichment",y=expression(-log[10](Pvalue)))
pqbar
pqbar+geom_hline(yintercept=2,color=c("red"),linetype=4)
分类R

发表评论

电子邮件地址不会被公开。 必填项已用*标注