画热图的包有很多个,热图的绘制是作为科研人员的基本素养,绘制热图的包我知道的有5个,heatmap函数、ggplot2包、gplot包、lattice包。今天初学pheatmap绘制热图,迫不及待的想要分享:
install.package("pheatmap") #安装包
library(pheatmap) #调用包
data <- read.table("111.csv",row.names=1,seq="t")#导入数据
pheatmap(data,scale = "column"#安行均一化,“row”,“column”,“none”默认是“none”,clustering_distance_rows = "correlation"#聚类线长度优化,treeheight_row = 40,#按照行聚类树高treeheight_col = 40#按列聚类树高,cluster_cols = FALSE,#是否按列聚类cluster_rows = F,#是否按行聚类display_numbers = F,#是否在每一个格上显示数据number_format = "%.2f",#显示数据格式,几位小数,或“”,颜色number_color,大小fontsize_number fontsize_row = 10,#行名称字体大小fontsize_col = 15,#列名称字体大小cellwidth = 50,cellheight = 14,main="ABC"#标题名称,gaps_row = c(10,15),#插入缝隙,不能聚类cutree_rows = 7,#按聚类分割show_colnames = TRUE#是否显示列名,color=colorRampPalette(c("green","white","red"),bias=2.5)(256),color=colorRampPalette(c("MediumBlue","white","red"))(256),#定义颜色border_color = "black",#定义格子框的颜色legend = FALSE,#是否显示图例legend_breaks = -1:4,#图例范围你filename = "111.pdf"#保存文件命令)