GO富集图

library(readxl)
library('ggplot2')
#pathway=read_xlsx('BSR_down.xlsx')
pathway=read_xlsx('BSR-down.xlsx')
dir()
Class<-pathway$GO
p = ggplot(pathway,aes(-1*log10(Pvalue),Pathway,shape=Class))
p=p + geom_point()
# 修稿点的大小
p=p + geom_point(aes(size=Count))
# 展示三维数据
pbubble = p+ geom_point(aes(size=Count,color=-1*log10(Pvalue)))
# 设置渐变色
pr = pbubble+scale_color_gradient(low="green",high = "red")
# 绘制p气泡图
pr = pr+labs(color=expression(-log[10](Pvalue)),size="Count",
             x="-log10(Pvalue)",y="Pathway name",title="Pathway enrichment")
pr + theme_bw()
ggsave("MSLT_down.pdf")# 保存为pdf格式
ggsave("MSLT_down.png",width=4,height=4)

数据类型

GO Pathway Pvalue Count
Cellular component photosystem II 8.89E-09 17
Cellular component photosystem 2.65E-08 18
Cellular component photosystem I 9.43E-08 12
Cellular component photosynthetic membrane 1.70548E-06 28
library(readxl)
library('ggplot2')
library(eoffice)
#pathway=read_xlsx('BSR_down.xlsx')
pathway=read_xlsx('GO_MSLT.xlsx',sheet = 2)
dir()
Class<-pathway$GO
p = ggplot(pathway,aes(-1*log10(Pvalue),Pathway))
p=p + geom_point()
# 修稿点的大小
p=p + geom_point(aes(size=Count))
# 展示三维数据
p= p+ geom_point(aes(size=Count))
# 设置渐变色
#p = p+scale_color_gradient(low="green",high = "red")
# 绘制p气泡图
p = p+labs(color=expression(-log[10](Pvalue)),size="Count",
             x="-log10(Pvalue)",y="Pathway",title="Pathway enrichment")
p + theme_bw()+theme(axis.text.x = element_text(size = 14,colour = "black",face = "bold",family = "serif"))+
  theme(axis.text.y = element_text(size = 14,colour = "black",face = "bold",family = "serif"))+
  theme(axis.title.x = element_text(size = 14,face = "bold",family = "serif"))+
  theme(axis.title.y = element_text(size = 14,face = "bold",family = "serif"))

#toffice(figure = p,format = "pptx",title=a,filename = "go.pptx",height = 7.5,width =8.5,append = TRUE)

#ggsave("MSLT_down.pdf")# 保存为pdf格式
ggsave("MSLT_up.png",width=6,height=5)
原文地址:https://www.cnblogs.com/xiaosagege/p/15771444.html