作者:郎郎2502918483 | 来源:互联网 | 2023-06-27 16:39
>install.packages("gplots")
> library("gplots")
> p <- data.frame(read.table("test.txt",header = T, sep="\t"))
> 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