3

我有以下代码用于使用“pheatmap”包生成热图。我成功地创建了热图,但很难注释列。我有 9 种细胞类型,每种细胞类型都有 3 个重复。

这是数据。我已将样本标记为 01_01,01_02,01_03 到 09_01、09_02,09_03。

我想将列注释为“A”、“B”、“C”、“D”、“E”、“F”、“G”、“H”、“I”。具有聚类行和列的 pheatmap

我尽力注释簇列,但没有成功。如果有人可以解释如何自定义列注释,我真的很感激。

数据: 我的数据文件

library(readxl)
library(pheatmap)
library(tibble)
library(dplyr)

读取文件

test<-read_excel("~test.xlsx",1)

test%>% 
   column_to_rownames("Metabolite") %>%
   as.data.frame()

test<-as.data.frame(test)
rownames(test)<-test$Metabolite
test$Metabolite<-NULL


    pheatmap(test,cluster_rows=TRUE,cluster_cols=TRUE,breaks=NA,scale="none",legend=TRUE,color=colorRampPalette(c("navy","white","firebrick3"))(50),margins=c(5,10),fontsize_row=4,fontsize_col=4,cellwidth=5,cellheight=5)
4

0 回答 0