美文网首页ggplot2绘图
复现Deseq排序后点图 | R

复现Deseq排序后点图 | R

作者: kkkkkkang | 来源:发表于2021-06-21 11:14 被阅读0次

最近发现NC上的一篇文章中的差异富集点图不错,复现一下

参考文献: https://www.nature.com/articles/s41467-021-23553-7

原图

这里只画一个图

  1. 数据格式


    image.png
  2. 画图
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
  1. 结果


    image.png

相关文章

网友评论

    本文标题:复现Deseq排序后点图 | R

    本文链接:https://www.haomeiwen.com/subject/ercyyltx.html