R: Obtain hierarchical color palettes (Tree Colors)

treepalette {treemap} | R Documentation

## Obtain hierarchical color palettes (Tree Colors)

### Description

Obtain hierarchical color palettes, either the so-called Tree Colors from the HCL color space model, or by using an existing color palette. The former method, which is recommended, is used by default in `treemap` (type `"index"`) and `treegraph`. Use `treecolors` to experiment with this method.

### Usage

    treepalette(dtf, index = names(dtf), method = "HCL", palette = NULL,
      palette.HCL.options, return.parameters = TRUE, prepare.dat = TRUE)

### Arguments

`dtf` | a data.frame or data.table. Required.
`index` | the index variables of dtf
`method` | used method: either `"HCL"` (recommended), which is based on the HCL color space model, or `"HSV"`, which uses the argument `palette`.
`palette` | color palette, which is only used for the HSV method
`palette.HCL.options` | list of options to obtain Tree Colors from the HCL space (when `palette="HCL"`). This list contains: `hue_start`: number between 0 and 360 that determines the starting hue value (default: 30) `hue_end`: number between `hue_start` and `hue_start + 360` that determines the ending hue value (default: 390) `hue_perm`: boolean that determines whether the colors are permuted such that adjacent levels get more distinguishable colors. If `FALSE`, then the colors are equally distributed from `hue_start` to `hue_end` (default: TRUE) `hue_rev`: boolean that determines whether the colors of even-numbered branched are reversed (to increase discrimination among branches) `hue_fraction`: number between 0 and 1 that determines the fraction of the hue circle that is used for recursive color picking: if 1 then the full hue circle is used, which means that the hue of the colors of lower-level nodes are spread maximally. If 0, then the hue of the colors of lower-level nodes are identical of the hue of their parents. (default: .5) `chroma`: chroma value of colors of the first-level nodes, that are determined by the first index variable (default: 60) `luminance`: luminance value of colors of the first-level nodes, i.e. determined by the first index variable (default: 70) `chroma_slope`: slope value for chroma of the non-first-level nodes. The chroma values for the second-level nodes are `chroma+chroma_slope`, for the third-level nodes `chroma+2*chroma_slope`, etc. (default: 5) `luminance_slope`: slope value for luminance of the non-first-level nodes (default: -10) For "depth" and "categorical" types, only the first two items are used. Use `treecolors` to experiment with these parameters.
`return.parameters` | should a data.frame with color values and parameter options be returned (`TRUE`), or just the vector of color values (`FALSE`)?
`prepare.dat` | data is by default preprocessed, except for interal use

### Value

Either a vector of colors, or a data.frame is return (see `return.parameters`).

[Package treemap version 2.4-2 Index]