Last chance! 50% off unlimited learning
Sale ends in
decorate_dend(heatmap, code, slice = 1, which = c("column", "row"))
seekViewport
and applies code
to that viewport.If you know the number of leaves in the dendrogram, it is simple to calculate the position of every leave in the dendrogram. E.g., for the column dendrogram, the i^th leave is located at:
# assume nc is the number of columns unit((i-0.5)/nc, "npc")
set.seed(123)
Heatmap(matrix(rnorm(100), 10), name = "mat", km = 2)
decorate_dend("mat", {
grid.rect(gp = gpar(fill = "#FF000080"))
}, which = "row", slice = 2)
Run the code above in your browser using DataLab