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)

Posted

in

by

Tags:

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *