When overlaying multiple 2D NMR spectra, one needs to supply a vector of colors for each spectrum contour,
as a list with length equal to the number of spectra to be plotted.
This is a convenience function which takes a vector of colors and copies it into a list, ready for
use with plotSpectra2D
.
LofC(cols, nspec = 1L, ncon = 1L, mode = 1L)
Character. A vector of color designations.
Integer. The number of spectra to be plotted.
Integer. The number of contour levels.
Integer. How to replicate the colors:
If mode = 1L
, each list element in the return value is a copy of cols
.
Use this mode when you want to use varied colors for the contour levels. length(cols)
must be the same as the number of contour levels passed to plotSpectra2D
,
possibly via LofL
.
If mode = 2L
, each list element in the return value is composed of a single color.
Use this mode when you want each spectrum to be plotted in its own color. The first list element
is ncon
replicates of cols[1]
, the second list element is
n
replicates of cols[2]
etc. length(cols)
must equal nspec
in this mode.
A list of length nspec
, the number of spectra to be plotted; each entry is a vector of colors.
mycols <- c("red", "green", "blue")
LofC(mycols, 1, 3, 1)
#> [[1]]
#> [1] "red" "green" "blue"
#>
LofC(mycols, 3, 3, 2)
#> [[1]]
#> [1] "red" "red" "red"
#>
#> [[2]]
#> [1] "green" "green" "green"
#>
#> [[3]]
#> [1] "blue" "blue" "blue"
#>