anno_horizon: Horizon chart Annotation

Description Usage Arguments Details Value See Also Examples

Description

Horizon chart Annotation

Usage

1
2
3
4
5
6
anno_horizon(x, which = c("column", "row"),
    gp = gpar(pos_fill = "#D73027", neg_fill = "#313695"),
    n_slice = 4, slice_size = NULL, negative_from_top = FALSE,
    normalize = TRUE, gap = unit(0, "mm"),
    axis = TRUE, axis_param = default_axis_param(which),
    width = NULL, height = NULL)

Arguments

x

A matrix or a list. If x is a matrix or a data frame, columns correspond to observations.

which

Whether it is a column annotation or a row annotation?

gp

Graphic parameters for the boxes. The length of the graphic parameters should be one or the number of observations. There are two unstandard parameters specificly for horizon chart: pos_fill and neg_fill controls the filled color for positive values and negative values.

n_slice

Number of slices on y-axis.

slice_size

Height of the slice. If the value is not NULL, n_slice will be recalculated.

negative_from_top

Whether the areas for negative values start from the top or the bottom of the plotting region?

normalize

Whether normalize x by max(abs(x)).

gap

Gap size of neighbouring horizon chart.

axis

Whether to add axis?

axis_param

parameters for controlling axis. See default_axis_param for all possible settings and default parameters.

width

Width of the annotation. The value should be an absolute unit. Width is not allowed to be set for column annotation.

height

Height of the annotation. The value should be an absolute unit. Height is not allowed to be set for row annotation.

Details

Horizon chart as row annotation is only supported.

Value

An annotation function which can be used in HeatmapAnnotation.

See Also

https://jokergoo.github.io/ComplexHeatmap-reference/book/heatmap-annotations.html#horizon-chart-annotation

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
lt = lapply(1:20, function(x) cumprod(1 + runif(1000, -x/100, x/100)) - 1)
anno = anno_horizon(lt, which = "row")
draw(anno, test = "horizon chart")
anno = anno_horizon(lt, which = "row", 
    gp = gpar(pos_fill = "orange", neg_fill = "darkgreen"))
draw(anno, test = "horizon chart, col")
anno = anno_horizon(lt, which = "row", negative_from_top = TRUE)
draw(anno, test = "horizon chart + negative_from_top")
anno = anno_horizon(lt, which = "row", gap = unit(1, "mm"))
draw(anno, test = "horizon chart + gap")
anno = anno_horizon(lt, which = "row", 
    gp = gpar(pos_fill = rep(c("orange", "red"), each = 10),
    neg_fill = rep(c("darkgreen", "blue"), each = 10)))
draw(anno, test = "horizon chart, col")

zhongmicai/complexHeatmap documentation built on May 7, 2019, 6:11 a.m.