系列文章目录
- 文献Figure复现篇:Cell同款 | 富集条形图
一、前言
R语言绘制Cell的同款富集分析条形图,如下所示。
二、数据准备
示例使用GO富集结果里部分条目做展示,主要使用Description和pvalue列。
三、脚本实现
library(ggplot2)
library(dplyr)
df = read.delim("test.txt",header=T,sep='\t')
df$log_p <- -log10(df$pvalue)
df$Description <- factor(df$Description,levels = rev(df$Description))
pdf("test.pdf")
p <- ggplot(df, aes(x= log_p, y= Description, fill=log_p)) +
scale_fill_distiller(palette = "YlOrRd", direction = 1) +
geom_bar(stat = 'identity', width = 0.8, alpha = 0.7) +
geom_text(aes(x = 0.1,
label = Description),
size = 8,
hjust = 0)+
labs(x = NULL,y = NULL,title="-Log10 Pvalue (Cellular Component enriched)") +
scale_x_continuous(expand = c(0,0),position="top")+
theme_classic() +
theme(axis.text.y = element_blank(),
axis.text.x = element_text(size = 21),
plot.title = element_text(size = 23,hjust = 0.5 ),
plot.margin = margin(t = 40,r = 40,b = 40,l = 40)) +
guides(fill=F)
print(p)
dev.off()
四、结果展示
五、参考文献
Wang J, Xu Y, Chen Z, Liang J, Lin Z, Liang H, Xu Y, Wu Q, Guo X, Nie J, Lu B, Huang B, Xian H, Wang X, Wu Q, Zeng J, Chai C, Zhang M, Lin Y, Zhang L, Zhao S, Tong Y, Zeng L, Gu X, Chen ZG, Yi S, Zhang T, Delfouneso D, Zhang Y, Nutt SL, Lew AM, Lu L, Bai F, Xia H, Wen Z, Zhang Y. Liver Immune Profiling Reveals Pathogenesis and Therapeutics for Biliary Atresia. Cell. 2020 Dec 23;183(7):1867-1883.e26.
六、补充
关注公众号在生信的坑里挖呀挖呀挖,底部菜单栏【挖到干货】里的【期刊同款图】查看!更新快,代码全部大放送!