anno_horizon.Rd
Horizon chart Annotation
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)
x | A matrix or a list. If |
---|---|
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: |
n_slice | Number of slices on y-axis. |
slice_size | Height of the slice. If the value is not |
negative_from_top | Whether the areas for negative values start from the top or the bottom of the plotting region? |
normalize | Whether normalize |
gap | Gap size of neighbouring horizon chart. |
axis | Whether to add axis? |
axis_param | parameters for controlling axis. See |
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. |
Horizon chart as row annotation is only supported.
An annotation function which can be used in HeatmapAnnotation
.
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")