Learn R Programming

ggspectra (version 0.3.16)

fast_wb2rect_df: Colours from wavebands

Description

Compute colours for a list of narrow wavebands or a range of wavelengths.

Usage

fast_wb2rect_df(w.band, chroma.type = "CMF", simplify = TRUE)

Value

A data frame with columns "x", "y", "w.length", "wb.color", "wl.high", "wl.low".

Arguments

w.band

waveband or list of waveband objects. The waveband(s) determine the wavelengths in variable w.length of the returned spectrum.

chroma.type

character telling whether "CMF", "CC", or "both" should be returned for human vision, or an object of class chroma_spct for any other trichromic visual system.

simplify

logical Flag indicating whether to merge neighbouring rectangles of equal color.

Details

Function fast_wb2rect_df() computes colours for wavebands based on the midpoint wavelength and uses vectorization when possible. It always returns color definitions with short names. The purpose of merging of rectangles is to speed up rendering and to reduce the size of vector graphics output. This function should be used with care as the color definitions returned are only approximate and original waveband names can be lost.

Function fast_wb2rect_df() intended use is when colour definitions are needed in a simple data frame as in the compute functions of statistics that return colours.