R绘图笔记 | GO-BP,GO-MF,GO-CC绘制在同一个柱状图中。

前面介绍过一些图形的绘制,我们有时候进行GO富集分析,需要绘制富集结果,这里介绍怎么将GO-BP,GO-MF,GO-CC绘制到同一图形中。

library(ggplot2)library(RColorBrewer)display.brewer.all()color <- brewer.pal(3,"Dark2")colorl <- rep(color,each=10)pdata <- read.table("pdata.txt",header = T,sep="\t")head(pdata)
ggplot(pdata) + aes(x = description, y = Counts, fill = GO) + geom_bar(stat = "identity",colour="black") + #scale_fill_hue() + scale_fill_manual(values =color)+ theme( axis.title=element_text(size=15,face="plain",color="black"), axis.text = element_text(size=12,face="plain",color="black"), axis.text.x = element_text(angle = 90,colour = colorl,hjust=1,vjust=0.6), axis.title.x = element_blank(), legend.title = element_blank(), legend.text = element_text(size = 8, face = "bold"), legend.margin = margin(t = 0, r = 0, b = 0, l = 0, unit = "pt"), legend.direction = "horizontal", legend.position = c(0.8,0.9), legend.background = element_blank(), panel.background = element_rect(fill = "transparent",colour = "black"), plot.background = element_blank() )
ggplot(pdata) + aes(x = description, y = Counts, fill = GO) + geom_bar(stat = "identity",colour="black") + #scale_fill_hue() + coord_flip()+ scale_fill_manual(values =color)+ theme( axis.title=element_text(size=15,face="plain",color="black"), axis.text = element_text(size=12,face="plain",color="black"), axis.text.y = element_text(colour = colorl,hjust=1,vjust=0.6), axis.title.y = element_blank(), legend.title = element_blank(), legend.text = element_text(size = 8, face = "bold"), legend.margin = margin(t = 0, r = 0, b = 0, l = 0, unit = "pt"), legend.direction = "vertical", legend.position = c(0.9,0.92), legend.background = element_blank(), panel.background = element_rect(fill = "transparent",colour = "black"), plot.background = element_blank() )
ggplot(pdata) + aes(x = description, y = Counts, fill = GO,size=Pvalue) + geom_point(shape=21,color="black") + #scale_fill_hue() + xlab("Counts")+ scale_fill_manual(values =color)+ coord_flip()+ theme( axis.title=element_text(size=15,face="plain",color="black"), axis.text = element_text(size=12,face="plain",color="black"), axis.text.x = element_text(angle = 90,hjust=1,vjust=0.6), axis.title.y = element_blank(), axis.text.y = element_text(colour = colorl), #legend.title = element_blank(), legend.text = element_text(size = 8, face = "bold"), legend.margin = margin(t = 0, r = 0, b = 0, l = 0, unit = "pt"), #legend.direction = "horizontal", #legend.position = c(0.5,0.9), legend.background = element_blank(), panel.background = element_rect(fill = "transparent",colour = "black"), plot.background = element_blank() )
ggplot(pdata) + aes(x = description, y = Counts, fill = GO,size=Pvalue) + geom_point(shape=21,color="black") + #scale_fill_hue() + xlab("Counts")+ scale_fill_manual(values =color)+ theme( axis.title=element_text(size=15,face="plain",color="black"), axis.text = element_text(size=12,face="plain",color="black"), axis.text.x = element_text(angle = 90,colour = colorl,hjust=1,vjust=0.6), axis.title.x = element_blank(), #legend.title = element_blank(), legend.text = element_text(size = 8, face = "bold"), legend.margin = margin(t = 0, r = 0, b = 0, l = 0, unit = "pt"), #legend.direction = "horizontal", #legend.position = c(0.5,0.9), legend.background = element_blank(), panel.background = element_rect(fill = "transparent",colour = "black"), plot.background = element_blank() )
(0)

相关推荐