所以,我正在尝试用pheatmap
R 中的函数创建一个漂亮的热图。
我想在树状图停止和图表开始的地方有彩色条,以便注释不同的集群。就像一条穿过列的水平粗线,当它传递到另一个集群时会改变颜色。我认为这很常见。但我无法弄清楚 pheatmap 中的“注释”。有任何想法吗?
structure<-matrix(rnorm(10000),ncol=100,nrow=100)
dist_structue<-dist(structure)
clustering<-hclust(dist)
cols2 = colorRampPalette(c('green','white','red'))(20)
annotation <- data.frame(Var1 = factor(cutree(clustering, k = 4))
heat_chem <- pheatmap(as.matrix(dist_structure),
clustering_distance_rows=dist_structure,
cellwidth = 4, cellheight = 4, cluster_rows=T,cluster_cols=T, legend = T,
clustering_distance_cols = dist_structure, show_rownames = TRUE,
fontsize_row = 5, annotation_row = annotation,
show_colnames = FALSE, cutree_cols = 4, cutree_rows=4,
color = cols2,
main = 'Heatmap')