Skip to contents

Withr mimic of with_options() for ComplexHeatmap options

Usage

with_ht_opts(new, code)

local_ht_opts(.new = list(), ..., .local_envir = parent.frame())

Arguments

new

list named by heatmap option, with corresponding values as described in ComplexHeatmap::ht_opt().

code

any valid R code to execute in the temporary environment.

Value

any The results of the evaluation of the code argument.

Details

This function uses the same mechanism as used by withr::with_options() except focuses on options defined by ComplexHeatmap::ht_opt().

Examples

ComplexHeatmap::ht_opt("COLUMN_ANNO_PADDING")
#> [1] 1mm
#> 1mm
with_ht_opts(list(COLUMN_ANNO_PADDING=grid::unit(3, "mm")),
   ComplexHeatmap::ht_opt("COLUMN_ANNO_PADDING"))
#> [1] 3mm
#> 3mm
ComplexHeatmap::ht_opt("COLUMN_ANNO_PADDING")
#> [1] 1mm
#> 1mm

test_local <- function() {
   local_ht_opts(list(COLUMN_ANNO_PADDING=grid::unit(3, "mm")))
   print(ComplexHeatmap::ht_opt("COLUMN_ANNO_PADDING"))
}
test_local()
#> [1] 3mm
#> 3mm
ComplexHeatmap::ht_opt("COLUMN_ANNO_PADDING")
#> [1] 1mm
#> 1mm