该柱形图纵坐标是路径名,横坐标是基因数量,颜色梯度为-log2(q-value)。代码如下:
setwd(".../06. WGCNA/turquoise")
a = read.table("05. KEGG-R.txt",header = T,sep="\t")
head(a)
library(ggplot2)
ggplot(a,aes(y=reorder(Pathways,Order),x=GeneNumbers,fill=X.LOG2.q.value.))+
geom_bar(stat = "identity")+
scale_fill_gradient(a$X.LOG2.q.value.,low = "blue",high = "red")+
labs(title = "Pathways Enrichment",
x = "Gene numbers",
y = "Pathways",
fill = "-Log2(q-value)")+
theme(axis.title.x = element_text(face = "bold",size = 16),
axis.title.y = element_text(face = "bold",size = 14),
legend.title = element_text(face = "bold",size = 14))+
theme_get()
得到的结果如下:
KEGG柱形图
我就没搞清楚那个legend的title怎么回事。待搞清楚了再补上。
得到的结果在AI上面修改,添加分类,可以得到如下结果:
AI修改
网友评论