man/densityHeatmap.rd
dd28e896
 \name{densityHeatmap}
 \alias{densityHeatmap}
 \title{
2c7a2087
 Use colors to represent density distribution
dd28e896
 }
 \description{
2c7a2087
 Use colors to represent density distribution
dd28e896
 }
 \usage{
12e85497
 densityHeatmap(data,
     col = rev(brewer.pal(11, "Spectral")),
9487d939
     density_param = list(na.rm = TRUE),
12e85497
     color_space = "LAB",
     anno = NULL,
     ylab = deparse(substitute(data)),
dc0ec14d
     title = paste0("Density heatmap of ", deparse(substitute(data))),
0449a230
     range = c(-Inf, Inf),
9cc6c383
     cluster_columns = FALSE,
     clustering_distance_columns = "euclidean",
     clustering_method_columns = "complete",
     column_dend_side = "top",
     column_dend_height = unit(10, "mm"),
     show_column_dend = FALSE,
     column_dend_gp = gpar(),
     column_dend_reorder = TRUE,
     column_names_side = c("bottom", "top"),
     show_column_names = TRUE,
     column_names_max_height = unit(4, "cm"),
     column_names_gp = gpar(fontsize = 12),
7cd2ea7d
     column_order = NULL,
dc0ec14d
     ...)
ba8a5070
 }
dd28e896
 \arguments{
 
b08d7ba4
   \item{data}{a matrix or a list. If it is a matrix, density will be calculated by columns.}
21ca48b4
   \item{col}{a list of colors that density values are mapped to.}
9487d939
   \item{density_param}{parameters send to \code{\link[stats]{density}}, \code{na.rm} is enforced to \code{TRUE}.}
451e6d73
   \item{color_space}{the color space in which colors are interpolated. Pass to \code{\link[circlize]{colorRamp2}}.}
21ca48b4
   \item{anno}{annotation for the matrix columns or the list. The value should be a vector or a data frame  and colors for annotations are randomly assigned. If you want to customize the annotation colors, use a \code{\link{HeatmapAnnotation-class}} object directly.}
dd28e896
   \item{ylab}{label on y-axis in the plot}
   \item{title}{title of the plot}
21ca48b4
   \item{range}{ranges on the y-axis. By default the range is between 1th quantile and 99th quantile of the data.}
9cc6c383
   \item{cluster_columns}{whether cluster columns (here cluster by density distributions)}
   \item{clustering_distance_columns}{pass to \code{\link{Heatmap}}}
   \item{clustering_method_columns}{pass to \code{\link{Heatmap}}}
   \item{column_dend_side}{pass to \code{\link{Heatmap}}}
   \item{column_dend_height}{pass to \code{\link{Heatmap}}}
   \item{show_column_dend}{pass to \code{\link{Heatmap}}}
   \item{column_dend_gp}{pass to \code{\link{Heatmap}}}
   \item{column_dend_reorder}{pass to \code{\link{Heatmap}}}
   \item{column_names_side}{pass to \code{\link{Heatmap}}}
   \item{show_column_names}{pass to \code{\link{Heatmap}}}
   \item{column_names_max_height}{pass to \code{\link{Heatmap}}}
   \item{column_names_gp}{pass to \code{\link{Heatmap}}}
7cd2ea7d
   \item{column_order}{order of columns}
dc0ec14d
   \item{...}{pass to \code{\link{draw,HeatmapList-method}}}
ba8a5070
 
dd28e896
 }
 \details{
12e85497
 To visualize data distribution in a matrix or in a list, sometimes we use boxplot or beanplot.
 Here we use colors to map the density values and visualize distribution of values
 in each column (or each vector in the list) through a heatmap. It is useful if you have huge number 
 of columns in \code{data} to visualize.
9487d939
 
 The density matrix is generated with 500 rows ranging between the maximun and minimal values in all densities.
 The density values in each row are linearly intepolated between the two density values at the two nearest bounds.
10b246c0
 }
 \value{
 No value is returned.
d94bdf93
 }
12e85497
 \author{
 Zuguang Gu <z.gu@dkfz.de>
 }
dd28e896
 \examples{
f0eb7a9f
 matrix = matrix(rnorm(100), 10); colnames(matrix) = letters[1:10]
dd28e896
 densityHeatmap(matrix)
 densityHeatmap(matrix, anno = rep(c("A", "B"), each = 5))
f0eb7a9f
 densityHeatmap(matrix, col = c("white", "red"), anno = rep(c("A", "B"), each = 5))
dc0ec14d
 
21ca48b4
 ha = HeatmapAnnotation(points = anno_points(runif(10)),
     anno = rep(c("A", "B"), each = 5), col = list(anno = c("A" = "red", "B" = "blue")))
b08d7ba4
 densityHeatmap(matrix, anno = ha)
dc0ec14d
 
f0eb7a9f
 lt = list(rnorm(10), rnorm(10))
d94bdf93
 densityHeatmap(lt)
dd28e896
 }