美文网首页
R语言热图-2020-01-08

R语言热图-2020-01-08

作者: 爬山小虎 | 来源:发表于2020-01-08 15:24 被阅读0次

一、整理数据成csv格式

data.csv

二、设置工作路径

setwd("{where you put your data}")

三、导入包

library(pheatmap)

library(ComplexHeatmap)

library(RColorBrewer)

四、画图

x<-read.csv('data.csv',header=T)

z1<-as.matrix(x[,2:{colnum number}])

rownames(z1)=x[,1]

pheatmap(z1,cluster_rows=F,cluster_cols=F,show_rownames=T,show_colnames=T,cellwidth=24,cellheight=5,fontsize=5,border=FALSE,color = colorRampPalette(c("yellow", "white", "blue"))(100),filename="result.pdf")

可以自己选择是否按行聚类,是否按列聚类,是否进行标准化,单元格长、宽、热图颜色

去掉边框线的参数为border=FALSE

更多详情,请参看Davey1220的这篇文章https://www.jianshu.com/p/1c55ea64ff3f

相关文章

网友评论

      本文标题:R语言热图-2020-01-08

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