R语言---热图的制作

>install.packages("gplots")

> library("gplots")
> p <- data.frame(read.table("test.txt",header = T, sep=" "))
> row.names(p) <- p$gene
> p <- p[,2:21]
> p_matrix<- data.matrix(p)

> heatmap(p_matrix, Rowv=NA, Colv=NA, col=cm.colors(256), revC=FALSE, scale='column')

对数据进行cluster:
> heatmap.2(p_matrix, col=colorpanel(100,low="yellow",high="red"), , scale="none",key=TRUE, keysize=1,symkey=FALSE, density.info="none", trace="none", cexRow=0.5)

对y轴进行数据进行cluster:
> heatmap.2(p_matrix, Colv=NA,col=colorpanel(100,low="yellow",high="red"), , scale="none",key=TRUE, keysize=1,symkey=FALSE, density.info="none", trace="none", cexRow=0.5)

对x轴进行数据进行cluster:

> heatmap.2(p_matrix, Rowv=NA,col=colorpanel(100,low="yellow",high="red"), , scale="none",key=TRUE, keysize=1,symkey=FALSE, density.info="none", trace="none", cexRow=0.5)

参考:http://www2.warwick.ac.uk/fac/sci/moac/people/students/peter_cock/r/heatmap

原文地址:https://www.cnblogs.com/yanzhi123/p/3414643.html