Description Usage Arguments Details Value Author(s) Examples
Use colors to represent density distribution
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | densityHeatmap(data,
col = rev(brewer.pal(11, "Spectral")),
density_param = list(na.rm = TRUE),
color_space = "LAB",
anno = NULL,
ylab = deparse(substitute(data)),
title = paste0("Density heatmap of ", deparse(substitute(data))),
range = c(-Inf, Inf),
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),
column_order = NULL,
...)
|
data |
a matrix or a list. If it is a matrix, density will be calculated by columns. |
col |
a list of colors that density values are mapped to. |
density_param |
parameters send to |
color_space |
the color space in which colors are interpolated. Pass to |
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 |
ylab |
label on y-axis in the plot |
title |
title of the plot |
range |
ranges on the y-axis. By default the range is between 1th quantile and 99th quantile of the data. |
cluster_columns |
whether cluster columns (here cluster by density distributions) |
clustering_distance_columns |
pass to |
clustering_method_columns |
pass to |
column_dend_side |
pass to |
column_dend_height |
pass to |
show_column_dend |
pass to |
column_dend_gp |
pass to |
column_dend_reorder |
pass to |
column_names_side |
pass to |
show_column_names |
pass to |
column_names_max_height |
pass to |
column_names_gp |
pass to |
column_order |
order of columns |
... |
pass to |
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 data
to visualize.
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.
No value is returned.
Zuguang Gu <z.gu@dkfz.de>
1 2 3 4 5 6 7 8 9 10 11 | matrix = matrix(rnorm(100), 10); colnames(matrix) = letters[1:10]
densityHeatmap(matrix)
densityHeatmap(matrix, anno = rep(c("A", "B"), each = 5))
densityHeatmap(matrix, col = c("white", "red"), anno = rep(c("A", "B"), each = 5))
ha = HeatmapAnnotation(points = anno_points(runif(10)),
anno = rep(c("A", "B"), each = 5), col = list(anno = c("A" = "red", "B" = "blue")))
densityHeatmap(matrix, anno = ha)
lt = list(rnorm(10), rnorm(10))
densityHeatmap(lt)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.