I am trying to use ComplexHeatmap to plot heatmap with annotation. The code that I have tried
library(ComplexHeatmap)
library(circlize)
set.seed(123)
mat = matrix(rnorm(25), 5)
rownames(mat) = paste0("R", 1:5)
colnames(mat) = paste0("C", 1:5)
col_fun = colorRamp2(c(0, 2, 5), c("white", "blue", "red"))
data_foo = c(0.1, 3, 1.6, 2.8, 4)
ha = HeatmapAnnotation(which = "row", foo = data_foo, col = list(foo = col_fun))
Heatmap(mat, name = "mat", right_annotation = ha)
ha1 = HeatmapAnnotation(which = "row", foo = anno_text(data_foo))
Heatmap(mat, name = "mat", right_annotation = ha1)
Can I obtain the annotation with colors varying as per the annotation values and also display the values in the annotation? i.e is it possible to combine the annotation in both figures?