wavelength2RGB: Convert Wavelength to RGB Colors

Description Usage Arguments Details Author(s) See Also Examples

View source: R/platereader.R

Description

Converts wavelength in nm (visible light: 380:780 nm) to RGB. NOTE that this is not a fully correct spectrum, see Details.

Usage

1
wavelength2RGB(wavelength)

Arguments

wavelength

the wavelength in nm to convert to RGB

Details

implemented following the java code posted at http://stackoverflow.com/questions/1472514/convert-light-frequency-to-rgb . Also see http://www.fourmilab.ch/documents/specrend/ for original code and why not all wavelengths can be converted to RGB.

Author(s)

Rainer Machne raim@tbi.univie.ac.at

See Also

showSpectrum

Examples

1
2
3
4
wavelengths <- seq(380,780,1)
cols <- sapply(wavelengths, wavelength2RGB)
bars <- rep(1,length(wavelengths)); names(bars) <- wavelengths
barplot(bars,border=cols,col=cols,las=2)

raim/platexpress documentation built on Jan. 18, 2022, 1:41 p.m.