【发布时间】:2022-12-05 22:03:43
【问题描述】:
| Pathway | #Proteins | Pvalue | Richfactor |
|---|---|---|---|
| Peptide chain elongation | 90 | 1.11E-16 | 0.5 |
| Translation elongation | 79 | 1.11E-16 | 0.7 |
| P53 pathway | 50 | 1.11E-16 | 0.2 |
| cGAS sting pathway | 20 | 1.11E-16 | 0.4 |
以上给出的是数据。使用此数据,我尝试生成具有 pvalue 和蛋白质的条形图,但我想向图表添加其他详细信息,例如上面数据中给出的 Rich factor。
library(ggplot2)
library(viridis)
top_fun <- read.delim(file="Pathways.txt",header = TRUE)
topfun <- as.data.frame(top_fun)
#Turn your 'Name' column into a character vector
topfun$Pathway <- as.character(topfun$Pathway)
#Then turn it back into a factor with the levels in the correct order
topfun$Pathway<- factor(topfun$Pathway, levels=unique(topfun$Pathway))
ggplot(topfun,aes(x=Group,y=topfun$Proteins,fill=topfun$Pvalue)) +
geom_col(position="dodge",width=0.4) +
coord_flip() + scale_fill_viridis(option="mako")+
facet_grid(Pathway~.)+
theme(strip.text.y = element_text(angle = 0))
我想在图表中添加其他详细信息,例如富因子。谢谢您的帮助!。
【问题讨论】: