美文网首页科研信息学
常规做图收录(ggpubr)

常规做图收录(ggpubr)

作者: 落寞的橙子 | 来源:发表于2020-10-25 03:05 被阅读0次

    1、成对分析

    常规用法
    rm(list=ls())
    suppressMessages(library(ggpubr))
    suppressMessages(library(tidyverse))
    suppressMessages(library(vcd))
    
    my_comparisons <- list(c("control", "treatment"))
    ggpaired(comb_fre_new, x = "xj", y ="percentage",ylab ="Gene 3' UTR Modification Frequence\n(% of Total Modificantion Events)",
                 line.color = "gray", line.size = 0.05,
                 palette = "npg"#c("#0A5EB9","#DF3D8C"
                )
    p<-p+stat_compare_means(comparisons = my_comparisons,
                            paired = T,method = "t.test",position = "identity",label = "p.signif")
    做完是一根线,所以进阶改良(还是ggplot2 靠谱)
    主要就是定义一个数xj 让它实现偏移
    comb_fre_new$Group <- factor(comb_fre_new$Group, levels=unique(comb_fre_new$Group))
    comb_fre_new$"x"<-c(rep(1,nrow(fed_fre)),rep(2,nrow(fasting_fre)))
    comb_fre_new$xj <- jitter(comb_fre_new$x, amount=.04)
    p<-ggplot(data=comb_fre_new, aes(y=percentage)) +
      geom_boxplot(aes(x=Group, group=Group), width=0.2, outlier.shape = NA) +
      geom_point(aes(x=xj,colour = factor(Group))) + scale_colour_manual(name="",values = c("control"="#0A5EB9", "treatment"="#DF3D8C"))+
      geom_line(aes(x=xj, group=gene_name),size=0.05,color="gray") +theme_bw()
    

    2、相关性分析

    suppressMessages(library(ggpubr))
    sp<-ggscatter(utr3_mean, x = "control", y = "treatment",
                  add.params = list(color =  "black",linetype="dashed"), # Customize reg. line
                  add = "reg.line",  # Add regressin line
                  conf.int = F,color ="#54C6DC",
                  ellipse.alpha=0.5,
                  xlab = "control",
                  ylab="treatment",
                  label = "Gene_symbol",
                  label.select = targets,
                  repel = T,
                  font.label =  c(11, "bold", "#f16446")
    )
    sp<-sp + stat_cor(method = "pearson")
    

    相关文章

      网友评论

        本文标题:常规做图收录(ggpubr)

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