Learn R Programming

MLPA (version 1.10.0)

wav2RGB: Converts light wavelengths to RGB colors

Description

Converts wavelengths in nanometers into corresponding visible colors.

Usage

wav2RGB(wav)

Arguments

wav

Numeric vector of wavelengths (in nanometers) to convert into colors.

Value

Returns a character vector of the same length as wav, with an RGB color for each wavelength. Wavelengths out of visible ranges return black.

References

http://codingmess.blogspot.fr/2009/05/conversion-of-wavelength-in-nanometers.html

Examples

Run this code
# NOT RUN {
  wv <- seq(from=300, to=800, by=10)
  plot(x=wv, y=rep(1, length(wv)), col=wav2RGB(wv), pch=19)
# }

Run the code above in your browser using DataLab