Zuguang Gu authored on 15/06/2022 10:42:56
Showing1 changed files
 ... ... @@ -8,7 +8,7 @@ Density Annotation 8 8  } 9 9  \usage{ 10 10  anno_density(x, which = c("column", "row"), 11 - type = c("lines", "violin", "heatmap"), xlim = NULL, 11 + type = c("lines", "violin", "heatmap"), xlim = NULL, max_density = NULL, 12 12  heatmap_colors = rev(brewer.pal(name = "RdYlBu", n = 11)), 13 13  joyplot_scale = 1, border = TRUE, gp = gpar(fill = "#CCCCCC"), 14 14  axis = TRUE, axis_param = default_axis_param(which), ... ... @@ -20,6 +20,7 @@ anno_density(x, which = c("column", "row"), 20 20  \item{which}{Whether it is a column annotation or a row annotation?} 21 21  \item{type}{Type of graphics to represent density distribution. "lines" for normal density plot; "violine" for violin plot and "heatmap" for heatmap visualization of density distribution.} 22 22  \item{xlim}{Range on x-axis.} 23 + \item{max_density}{Maximal density values in the plot. Normally you don't need to manually set it, but when you have multiple density annotations and you want to compare between them, you should manually set this argument to make density distributions are in a same scale.} 23 24  \item{heatmap_colors}{A vector of colors for interpolating density values.} 24 25  \item{joyplot_scale}{Relative height of density distribution. A value higher than 1 increases the height of the density distribution and the plot will represented as so-called "joyplot".} 25 26  \item{border}{Wether draw borders of the annotation region?}

 ... ... @@ -8,7 +8,7 @@ Density Annotation 8 8  } 9 9  \usage{ 10 10  anno_density(x, which = c("column", "row"), 11 - type = c("lines", "violin", "heatmap"), 11 + type = c("lines", "violin", "heatmap"), xlim = NULL, 12 12  heatmap_colors = rev(brewer.pal(name = "RdYlBu", n = 11)), 13 13  joyplot_scale = 1, border = TRUE, gp = gpar(fill = "#CCCCCC"), 14 14  axis = TRUE, axis_param = default_axis_param(which), ... ... @@ -19,6 +19,7 @@ anno_density(x, which = c("column", "row"), 19 19  \item{x}{A matrix or a list. If \code{x} is a matrix and if \code{which} is \code{column}, statistics for boxplots are calculated by columns, if \code{which} is \code{row}, the calculation is done by rows.} 20 20  \item{which}{Whether it is a column annotation or a row annotation?} 21 21  \item{type}{Type of graphics to represent density distribution. "lines" for normal density plot; "violine" for violin plot and "heatmap" for heatmap visualization of density distribution.} 22 + \item{xlim}{Range on x-axis.} 22 23  \item{heatmap_colors}{A vector of colors for interpolating density values.} 23 24  \item{joyplot_scale}{Relative height of density distribution. A value higher than 1 increases the height of the density distribution and the plot will represented as so-called "joyplot".} 24 25  \item{border}{Wether draw borders of the annotation region?}
 1 1 new file mode 100644 ... ... @@ -0,0 +1,49 @@ 1 +\name{anno_density} 2 +\alias{anno_density} 3 +\title{ 4 +Density Annotation 5 +} 6 +\description{ 7 +Density Annotation 8 +} 9 +\usage{ 10 +anno_density(x, which = c("column", "row"), 11 + type = c("lines", "violin", "heatmap"), 12 + heatmap_colors = rev(brewer.pal(name = "RdYlBu", n = 11)), 13 + joyplot_scale = 1, border = TRUE, gp = gpar(fill = "#CCCCCC"), 14 + axis = TRUE, axis_param = default_axis_param(which), 15 + width = NULL, height = NULL) 16 +} 17 +\arguments{ 18 + 19 + \item{x}{A matrix or a list. If \code{x} is a matrix and if \code{which} is \code{column}, statistics for boxplots are calculated by columns, if \code{which} is \code{row}, the calculation is done by rows.} 20 + \item{which}{Whether it is a column annotation or a row annotation?} 21 + \item{type}{Type of graphics to represent density distribution. "lines" for normal density plot; "violine" for violin plot and "heatmap" for heatmap visualization of density distribution.} 22 + \item{heatmap_colors}{A vector of colors for interpolating density values.} 23 + \item{joyplot_scale}{Relative height of density distribution. A value higher than 1 increases the height of the density distribution and the plot will represented as so-called "joyplot".} 24 + \item{border}{Wether draw borders of the annotation region?} 25 + \item{gp}{Graphic parameters for the boxes. The length of the graphic parameters should be one or the number of observations.} 26 + \item{axis}{Whether to add axis?} 27 + \item{axis_param}{parameters for controlling axis. See \code{\link{default_axis_param}} for all possible settings and default parameters.} 28 + \item{width}{Width of the annotation. The value should be an absolute unit. Width is not allowed to be set for column annotation.} 29 + \item{height}{Height of the annotation. The value should be an absolute unit. Height is not allowed to be set for row annotation.} 30 + 31 +} 32 +\value{ 33 +An annotation function which can be used in \code{\link{HeatmapAnnotation}}. 34 +} 35 +\seealso{ 36 +\url{https://jokergoo.github.io/ComplexHeatmap-reference/book/heatmap-annotations.html#density-annotation} 37 +} 38 +\examples{ 39 +m = matrix(rnorm(100), 10) 40 +anno = anno_density(m, which = "row") 41 +draw(anno, test = "normal density") 42 +anno = anno_density(m, which = "row", type = "violin") 43 +draw(anno, test = "violin") 44 +anno = anno_density(m, which = "row", type = "heatmap") 45 +draw(anno, test = "heatmap") 46 +anno = anno_density(m, which = "row", type = "heatmap",  47 + heatmap_colors = c("white", "orange")) 48 +draw(anno, test = "heatmap, colors") 49 +}