Constructor Method for ColorMapping Class

ColorMapping(name, colors = NULL, levels = NULL,
    col_fun = NULL, breaks = NULL, na_col = "#FFFFFF")

Arguments

name

Name for this color mapping. The name is automatically generated if it is not specified.

colors

Discrete colors.

levels

Levels that correspond to colors. If colors is name indexed, levels can be ignored.

col_fun

Color mapping function that maps continuous values to colors.

breaks

Breaks for the continuous color mapping. If col_fun is generated by colorRamp2, breaks is automatically inferred from the color mapping function.

na_col

Colors for NA values.

Details

colors and levels are used for discrete color mapping, col_fun and breaks are used for continuous color mapping.

Value

A ColorMapping-class object.

Examples

cm = ColorMapping(colors = c("A" = "red", "B" = "black")) cm
#> Discrete color mapping: #> name: color_mapping_1 #> levels: #> [1] "A" "B" #> #> colors: #> [1] "#FF0000FF" "#000000FF" #>
require(circlize)
#> Loading required package: circlize
#> ======================================== #> circlize version 0.4.9 #> CRAN page: https://cran.r-project.org/package=circlize #> Github page: https://github.com/jokergoo/circlize #> Documentation: http://jokergoo.github.io/circlize_book/book/ #> #> If you use it in published research, please cite: #> Gu, Z. circlize implements and enhances circular visualization #> in R. Bioinformatics 2014. #> ========================================
col_fun = colorRamp2(c(0, 1), c("white", "red")) cm = ColorMapping(col_fun = col_fun)