man/decorate_heatmap_body.rd
7f268eeb
 \name{decorate_heatmap_body}
 \alias{decorate_heatmap_body}
 \title{
 Decorate the heatmap body
 }
 \description{
 Decorate the heatmap body
 }
 \usage{
d240a4c0
 decorate_heatmap_body(heatmap, code, slice = 1, envir = new.env(parent = parent.frame()))
ba8a5070
 }
7f268eeb
 \arguments{
 
793b75de
   \item{heatmap}{name of the heatmap which is set as \code{name} option in \code{\link{Heatmap}} function}
12e85497
   \item{code}{code that adds graphics in the selected heatmap body}
793b75de
   \item{slice}{index of row slices in the heatmap if it is split by rows}
d240a4c0
   \item{envir}{where to look for variables inside \code{code}}
ba8a5070
 
7f268eeb
 }
 \details{
12e85497
 There is a viewport for each row slice in each heatmap.
 This function contructs the name of the viewport,
7f268eeb
 goes to the viewport by \code{\link[grid]{seekViewport}} and applies code
 to that viewport.
12e85497
 
378e5021
 If you know the number of rows and columns for that row slice, it is
12e85497
 simple to calculate the position of every small grid in the row slice.
 E.g., the position for the grid in i^th row and j^th column is:
 
   \preformatted{
     # assume nc is the number of columns 
     # and nr is the number of rows in that row slice
     unit((i-0.5)/nc, "npc")
     unit((j-0.5)/nr, "npc")
 
     # the width is
     unit(1/nc, "npc")
 
     # the height is
     unit(1/nr, "npc")  }
 }
 \value{
 This function returns no value.
7f268eeb
 }
 \author{
 Zuguang Gu <z.gu@dkfz.de>
 }
 \examples{
 set.seed(123)
 Heatmap(matrix(rnorm(100), 10), name = "mat")
 decorate_heatmap_body("mat", {
     grid.circle(gp = gpar(fill = "#FF000080"))
 })
 }