最近发现NC上的一篇文章中的差异富集点图不错,复现一下
参考文献: https://www.nature.com/articles/s41467-021-23553-7
原图这里只画一个图
-
数据格式
image.png - 画图
setwd("D:/bioinfo/R learn")
library("ggplot2")
library("dplyr")
deg <- read.table("deseq_simulate.txt", header = TRUE) %>%
arrange(desc(FoldChange)) # sort by foldchagne, reversed
deg$Category <- factor(deg$Category, levels = deg$Category) # order
ggplot(deg, aes(x = Category, y = FoldChange, fill = Signif)) +
geom_point(size = 4, shape = 21, colour = "#40916c") +
geom_hline(yintercept = 1, linetype = "dashed", size = 1) + # add ref line
scale_fill_manual(values = c(NA, "#40916c")) + # change color manually
theme_bw() +
theme(panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
plot.title = element_text(hjust = 0.5), # center title
axis.text = element_text(size = 8),
axis.title = element_text(size = 12,face = "bold")) +
ggtitle("A vs. B") + # add title
# xlab(NULL) + # remove xlab title
ylab("Fold Change") +
# guides(fill = FALSE) + # remove legend
coord_flip()
ggsave("deseq.pdf", width = 3, height = 4) # save pdf
-
结果
image.png
网友评论