Learn R Programming

ChemoSpec (version 3.0-1)

conColScheme: Change the Color Scheme of a Spectra Object

Description

This function permits you to change the color scheme of an existing "Spectra" object.

Usage

conColScheme(spectra, old = levels(as.factor(spectra$colors)),
	new = NULL)

Arguments

spectra
An object of S3 class "Spectra" whose color scheme is to be changed.
old
A character vector of the old color names; will be searched for and replaced one-for-one by the character vector in new.
new
A character vector of the new (replacement) color schemes.

Value

  • An object of S3 class "Spectra" whose color scheme has been changed.

Details

A grepping process is used. Depending upon the nature of the old color names to be searched for, you might need to add some grep pattern matching strings to the color name.

References

https://github.com/bryanhanson/ChemoSpec

See Also

For a discussion of general issues of color, see colorSymbol.

Examples

Run this code
data(CuticleIR)
sumSpectra(CuticleIR)
newSpec <- conColScheme(CuticleIR,
	new = c("pink", "violet", "green", "sienna"))
sumSpectra(newSpec)

Run the code above in your browser using DataLab