Does anyone show me how to put the expression key index and the legend key to appear at the bottom of the heatmap using pheatmap? you can use the following code to generate the heatmap. Thank you so much!
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)