【简单热图】
# 调用下载的pheatmap包。 library(pheatmap)#设置当前工作目录,setwd("目标路径")即保存待测文件的目录,使R能够调用。 setwd("C:/Users/81927/Desktop") # exp,样品表达量;cellwidth,热图每格宽度;cellheight,热图每格高度; # cluster_cols,对列进行聚类;cluster_rows,对行进行聚类; exppheatmap(exp,cellwidth = 20,cellheight = 10, cluster_cols = T, cluster_rows = T)
# 对表达量取以2为底的对数 pheatmap(log((exp+1),2),cellwidth = 20,cellheight = 10,cluster_cols = T,cluster_rows = T)# 更换热图颜色,colorRampPalette函数支持自定义的创建一系列的颜色梯度。pheatmap(log((exp+1),2),cellwidth=20, cellheight=10, cluster_cols=F, cluster_rows=T, color=colorRampPalette(c("navy","white","red"))(10))