#热图
install.packages("pheatmap")#如果这个不行采用下面安装方式
#目前R镜像出现问题上述不行,则需要先利用下面语句把镜像中https更换成http;然后进行正常安装
options(BioC_mirror="http://mirrors.tuna.tsinghua.edu.cn/bioconductor/")
options("repos" = c(CRAN="http://mirrors.tuna.tsinghua.edu.cn/CRAN/"))
BiocManager::install("pheatmap")
#install.packages('包')
library(pheatmap)
setwd('C:/Users/Tao/Desktop')
test=read.csv('heatmap.txt',sep = "\t",header = T)
head(test)
rownames(test)=test$ID
test=test[c(-1)]
rownames(test)
pheatmap(test, scale = "row")
pheatmap(test, scale = "row", clustering_distance_rows = "correlation")
# color参数自定义颜色
pheatmap(test,
scale = "row",#行均一化
clustering_distance_rows = "correlation",
color = colorRampPalette(c("cyan3 ", "white ", "darkorchid1 "))(50), #自定义颜色
border=FALSE, #不带边框
cluster_cols= FALSE,
show_rownames = FALSE) #不显示基因名字
)
网友评论