chl_pal: Ocean colour colours for chlorophyll-a.

View source: R/palr.R

chl_palR Documentation

Ocean colour colours for chlorophyll-a.

Description

Ocean colour palette for chlorophyll-a.

Usage

chl_pal(x, palette = FALSE, alpha = 1)

chlPal(x, palette = FALSE, alpha = 1, ...)

Arguments

x

a vector of data values or a single number

palette

logical, if TRUE return a list with matching colours and values

alpha

value in 0,1 to specify opacity

...

currently unused

Details

Flexible control of the chlorophyll-a palette. If x is a single number, the function returns that many colours evenly spaced from the palette. If x is a vector of multiple values the palette is queried for colours matching those values, and these are returned. If x is missing and palette is FALSE then a function is returned that will generate n evenly spaced colours from the palette, as per colorRampPalette.

Value

colours, palette, or function, see Details

References

Derived from a file once found at 'http://oceancolor.gsfc.nasa.gov/DOCS/palette_chl_etc.txt'

Examples

## Not run: 
chl <- raadtools::readchla(xylim = c(100, 110, -50, -40))
## just get a small number of evenly space colours
plot(chl, col = chl_pal(10))
## store the full palette and work with values and colours
pal <- chl_pal()
## the standard full palette
plot(chl, breaks = pal$breaks, col = pal$cols)
## a custom set of values with matching colours
plot(chl, col = chl_pal(pal$breaks[seq(1, length(pal$breaks), length = 10)]))
## any number of colours stored as a function
myfun <- chl_pal()
plot(chl, col = myfun(18))
## just n colours
plot(chl, col = chl_pal(18))

## End(Not run)

AustralianAntarcticDivision/palr documentation built on July 12, 2024, 6:42 a.m.