data(tea)
tea <- lapply(tea.raw, preprocess, maxI = 100)
ncomp <- 7
spectra <- opa(tea, ncomp)
myPalette <- colorRampPalette(c("black", "red", "blue", "green"))
mycols <- myPalette(ncomp)
matplot(as.numeric(rownames(spectra)), spectra, type = "l", lty = 1,
xlab = expression(lambda), ylab = "", col = mycols)
legend("topright", legend = paste("Comp.", 1:ncomp), col = mycols,
lty = 1, ncol = 2, bty = "n")
Run the code above in your browser using DataLab