美文网首页
如何画出漂亮的热图?

如何画出漂亮的热图?

作者: ShanSly | 来源:发表于2022-05-12 09:20 被阅读0次

    code如下:

    setwd('C:/Users/Administrator/Desktop/LSM测序总结/heatmap')
    rm(list = ls())
    library(pheatmap)
    library(RColorBrewer)
    data <- read.csv(file = "deg_heatmap.csv",header = T,sep = ",")
    
    data1 <- data
    rownames(data1) <- data[,1]
    data1 <- data1[,-1]
    exprSet <- data1
    
    qx <- as.numeric(quantile(exprSet, c(0., 0.25, 0.5, 0.75, 0.99, 1.0), na.rm=T))
    LogC <- (qx[5] > 100) ||
      (qx[6]-qx[1] > 50 && qx[2] > 0) ||
      (qx[2] > 0 && qx[2] < 1 && qx[4] > 1 && qx[4] < 2)
    LogC
    exprSet <- log2(exprSet[,]+1)
    pheatmap(exprSet)
    
    ##plot[AU]
    my_col<-colorRampPalette(c(c("#481467","#2e6f8e","#1fa088","#6ccd5a","#e7e419")))(100)     
    ## my_col<-colorRampPalette(rev(brewer.pal(n = 9, name = "YlGn")))(100)
    pheatmap(exprSet,scale = "row",cluster_cols=F,cluster_rows=F,show_rownames = F, color = my_col,cellwidth =15,
             cellheight =0.5, legend = T, fontsize = 8, border_color = 8,show_colnames=T)
    

    记得点赞收藏哦~

    相关文章

      网友评论

          本文标题:如何画出漂亮的热图?

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