番外.3

作者: 半夜一更 | 来源:发表于2021-03-11 14:21 被阅读0次

    以前同一个课题组的同事要写基金,给他用pheatmap 画一个可以控制颜色条的热图。

    # install.packages("pheatmap")
    # install.packages("openxlsx")
    library(pheatmap)
    library(openxlsx)
    getwd()
    setwd('/Users/XXX/Desktop')
    rm(list=ls())
    data_raw <- read.xlsx("工作簿2.xlsx",sheet=1,rowNames = T,colNames = T )
    data <- data_raw
    bk <- c(seq(-8,-0.1,by=0.01),seq(0,8,by=0.01))
    pheatmap(data,cluster_row =T,cluster_col=FALSE ,scale='row'
             ,border_color=NA,show_rownames = F, show_colnames = F
             #,clustering_method = "ward.D2"
             #,annotation_col=annotation_col
             #,annotation_row=annotation_row
             #,annotation_colors=ann_colors
             #, color = colorRampPalette(colors = c("blue","white","red"))(100)
             ,color = c(colorRampPalette(colors = c("green","black"))(length(bk)/2),colorRampPalette(colors = c("black","red"))(length(bk)/2)),legend_breaks=seq(-8,8,2),breaks=bk
             , width=5, hight= 1000, filename="test.2.pdf"
             )
    

    相关文章

      网友评论

          本文标题:番外.3

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