densityHeatmap: Visualize Density Distribution by Heatmap

Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/densityHeatmap.R

Description

Visualize Density Distribution by Heatmap

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
densityHeatmap(data,
    density_param = list(na.rm = TRUE),
    
    col = rev(brewer.pal(11, "Spectral")),
    color_space = "LAB",
    ylab = deparse(substitute(data)),
    column_title = paste0("Density heatmap of ", deparse(substitute(data))),
    title = column_title,
    ylim = NULL,
    range = ylim,
    
    title_gp = gpar(fontsize = 14),
    ylab_gp = gpar(fontsize = 12),
    tick_label_gp = gpar(fontsize = 10),
    quantile_gp = gpar(fontsize = 10),
    show_quantiles = TRUE,
    
    column_order = NULL,
    column_names_side = "bottom",
    show_column_names = TRUE,
    column_names_max_height = unit(6, "cm"),
    column_names_gp = gpar(fontsize = 12),
    column_names_rot = 90,
    
    cluster_columns = FALSE,
    clustering_distance_columns = "ks",
    clustering_method_columns = "complete",
    mc.cores = 1,
    
    ...)

Arguments

data

A matrix or a list. If it is a matrix, density is calculated by columns.

density_param

Parameters send to density, na.rm is enforced to be TRUE.

col

A vector of colors that density values are mapped to.

color_space

The color space in which colors are interpolated. Pass to colorRamp2.

ylab

Label on y-axis.

column_title

Title of the heatmap.

title

Same as column_title.

ylim

Ranges on the y-axis.

range

Same as ylim.

title_gp

Graphic parameters for title.

ylab_gp

Graphic parameters for y-labels.

tick_label_gp

Graphic parameters for y-ticks.

quantile_gp

Graphic parameters for the quantiles.

show_quantiles

Whether show quantile lines.

column_order

Order of columns.

column_names_side

Pass to Heatmap.

show_column_names

Pass to Heatmap.

column_names_max_height

Pass to Heatmap.

column_names_gp

Pass to Heatmap.

column_names_rot

Pass to Heatmap.

cluster_columns

Whether cluster columns?

clustering_distance_columns

There is a specific distance method ks which is the Kolmogorov-Smirnov statistic between two distributions. For other methods, the distance is calculated on the density matrix.

clustering_method_columns

Pass to Heatmap.

mc.cores

Multiple cores for calculating ks distance.

...

Pass to Heatmap.

Details

To visualize data distribution in a matrix or in a list, we normally use boxplot or violinplot. We can also use colors to map the density values and visualize distribution of values through a heatmap. It is useful if you have huge number of columns in data to visualize.

The density matrix is generated with 500 rows ranging between the maximun and minimal values in all densities.

Value

A Heatmap-class object. It can oly add other heatmaps/annotations vertically.

Author(s)

Zuguang Gu <z.gu@dkfz.de>

See Also

https://jokergoo.github.io/ComplexHeatmap-reference/book/other-high-level-plots.html#density-heatmap

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
matrix = matrix(rnorm(100), 10); colnames(matrix) = letters[1:10]
densityHeatmap(matrix)

lt = list(rnorm(10), rnorm(10))
densityHeatmap(lt)

ha = HeatmapAnnotation(points = anno_points(runif(10)),
    anno = rep(c("A", "B"), each = 5), col = list(anno = c("A" = "red", "B" = "blue")))
densityHeatmap(matrix, top_annotation = ha)
densityHeatmap(matrix, top_annotation = ha) %v% Heatmap(matrix, height = unit(6, "cm"))

Example output

Loading required package: grid
========================================
ComplexHeatmap version 2.6.2
Bioconductor page: http://bioconductor.org/packages/ComplexHeatmap/
Github page: https://github.com/jokergoo/ComplexHeatmap
Documentation: http://jokergoo.github.io/ComplexHeatmap-reference

If you use it in published research, please cite:
Gu, Z. Complex heatmaps reveal patterns and correlations in multidimensional 
  genomic data. Bioinformatics 2016.

This message can be suppressed by:
  suppressPackageStartupMessages(library(ComplexHeatmap))
========================================

ComplexHeatmap documentation built on Nov. 14, 2020, 2:01 a.m.