autopal {paletteknife}R Documentation

Auto-Palette

Description

Return a palette vector from one of the built-in sets

Usage

autopal(set = "", n = 30, limits = NA, bias = 1, legend_len = 6)

Arguments

set

Colour set to use – see ?autocol for full list. A default sasha or viridis is chosen if empty.

n

Length of colour vector to return, must be at least 2

limits

Colour scale limits to pass to legend eg c(0,10) – if left as NA no autolegend will be generated

bias

Skew to apply to colour-ramp (>1 increases resolution at low end, <1 at the high end)

legend_len

Continuous legend target size

Details

This can be used where a palette is provided rather than a mapped colour vector, for example image(). The limits must be specified for autolegend() information to be updated. Custom colour limits can be set using breaks or levels (see examples) if the same colour range is needed across several plots.

See ?autocol for list of all available colour sets.

Value

A character vector of colours of length n giving a continuous colour palette sampled from set. If limits are specified, information for a colour legend is produced of approximate length legend_len. This is stored in options('autolegend') and not returned explicitly.

Examples

image(volcano, col=autopal('RdYlGn', n=100, limits=c(50,200), bias=1.5),
    breaks=seq(50,200,length.out=101) )
  autolegend('bottom', inset=1, ncol=5)

# Or using the slightly smarter filled.contour
filled.contour(volcano, col=autopal('RdYlGn', n=20, limits=c(100,150)),
  levels=seq(50,200,length.out=21) )


[Package paletteknife version 0.4.2 Index]