【发布时间】:2020-09-18 07:39:35
【问题描述】:
有没有人告诉我如何使用 pheatmap 将表达式键索引和图例键显示在热图的底部?您可以使用以下代码生成热图。 非常感谢!
test = matrix(rnorm(200), 20, 10)
test[1:10, seq(1, 10, 2)] = test[1:10, seq(1, 10, 2)] + 3
test[11:20, seq(2, 10, 2)] = test[11:20, seq(2, 10, 2)] + 2
test[15:20, seq(2, 10, 2)] = test[15:20, seq(2, 10, 2)] + 4
colnames(test) = paste("Test", 1:10, sep = "")
rownames(test) = paste("Gene", 1:20, sep = "")
annotation_col = data.frame(
CellType = factor(rep(c("CT1", "CT2"), 5)), Time = c("A", "B", "C","D","E"))
rownames(annotation_col) = paste("Test",1:10, sep = "")
ann_colors = list(
Time = c(A = "white", B= "firebrick", C= "#fdbb84",D = "#e34a33", E = "red"),
CellType = c(CT1 = "#1B9E77", CT2 = "#D95F02"))
library("pheatmap")
pheatmap(test, annotation_col = annotation_col, annotation_colors = ann_colors)
【问题讨论】:
-
请始终包含
library电话,这一次我帮助了你。