mapcol: Scale Qualitative Values to Color

Description Usage Arguments Value Examples

Description

A simple util function that scales a factor to color based on the palette function.

Usage

1
mapcol(value, palette.fun = grDevices::rainbow, ...)

Arguments

value

A factor or character vector that may have n unique values.

palette.fun

The palette function to generate colors. For example, terrain.colors.

...

Extra arguments passed to the palette function.

Value

A character vector as colors, with the same length of value. Same values in value will have the same color.

Examples

1
mapcol(iris$Species)

Example output

Loading required package: GenomicRanges
Loading required package: stats4
Loading required package: BiocGenerics
Loading required package: parallel

Attaching package:BiocGenericsThe following objects are masked frompackage:parallel:

    clusterApply, clusterApplyLB, clusterCall, clusterEvalQ,
    clusterExport, clusterMap, parApply, parCapply, parLapply,
    parLapplyLB, parRapply, parSapply, parSapplyLB

The following objects are masked frompackage:stats:

    IQR, mad, sd, var, xtabs

The following objects are masked frompackage:base:

    anyDuplicated, append, as.data.frame, basename, cbind, colnames,
    dirname, do.call, duplicated, eval, evalq, Filter, Find, get, grep,
    grepl, intersect, is.unsorted, lapply, Map, mapply, match, mget,
    order, paste, pmax, pmax.int, pmin, pmin.int, Position, rank,
    rbind, Reduce, rownames, sapply, setdiff, sort, table, tapply,
    union, unique, unsplit, which.max, which.min

Loading required package: S4Vectors

Attaching package:S4VectorsThe following object is masked frompackage:base:

    expand.grid

Loading required package: IRanges
Loading required package: GenomeInfoDb
  [1] "#FF0000" "#FF0000" "#FF0000" "#FF0000" "#FF0000" "#FF0000" "#FF0000"
  [8] "#FF0000" "#FF0000" "#FF0000" "#FF0000" "#FF0000" "#FF0000" "#FF0000"
 [15] "#FF0000" "#FF0000" "#FF0000" "#FF0000" "#FF0000" "#FF0000" "#FF0000"
 [22] "#FF0000" "#FF0000" "#FF0000" "#FF0000" "#FF0000" "#FF0000" "#FF0000"
 [29] "#FF0000" "#FF0000" "#FF0000" "#FF0000" "#FF0000" "#FF0000" "#FF0000"
 [36] "#FF0000" "#FF0000" "#FF0000" "#FF0000" "#FF0000" "#FF0000" "#FF0000"
 [43] "#FF0000" "#FF0000" "#FF0000" "#FF0000" "#FF0000" "#FF0000" "#FF0000"
 [50] "#FF0000" "#00FF00" "#00FF00" "#00FF00" "#00FF00" "#00FF00" "#00FF00"
 [57] "#00FF00" "#00FF00" "#00FF00" "#00FF00" "#00FF00" "#00FF00" "#00FF00"
 [64] "#00FF00" "#00FF00" "#00FF00" "#00FF00" "#00FF00" "#00FF00" "#00FF00"
 [71] "#00FF00" "#00FF00" "#00FF00" "#00FF00" "#00FF00" "#00FF00" "#00FF00"
 [78] "#00FF00" "#00FF00" "#00FF00" "#00FF00" "#00FF00" "#00FF00" "#00FF00"
 [85] "#00FF00" "#00FF00" "#00FF00" "#00FF00" "#00FF00" "#00FF00" "#00FF00"
 [92] "#00FF00" "#00FF00" "#00FF00" "#00FF00" "#00FF00" "#00FF00" "#00FF00"
 [99] "#00FF00" "#00FF00" "#0000FF" "#0000FF" "#0000FF" "#0000FF" "#0000FF"
[106] "#0000FF" "#0000FF" "#0000FF" "#0000FF" "#0000FF" "#0000FF" "#0000FF"
[113] "#0000FF" "#0000FF" "#0000FF" "#0000FF" "#0000FF" "#0000FF" "#0000FF"
[120] "#0000FF" "#0000FF" "#0000FF" "#0000FF" "#0000FF" "#0000FF" "#0000FF"
[127] "#0000FF" "#0000FF" "#0000FF" "#0000FF" "#0000FF" "#0000FF" "#0000FF"
[134] "#0000FF" "#0000FF" "#0000FF" "#0000FF" "#0000FF" "#0000FF" "#0000FF"
[141] "#0000FF" "#0000FF" "#0000FF" "#0000FF" "#0000FF" "#0000FF" "#0000FF"
[148] "#0000FF" "#0000FF" "#0000FF"

TnT documentation built on Nov. 8, 2020, 8:11 p.m.