# NOT RUN {
# load LUT
data(pms.munsell.lut)
## 1. Pantone -> Munsell
# colors to match
colors <- c('10YR 3/3', '7.5YR 4/6')
# index / subset match
idx <- pms.munsell.lut$munsell %in% colors
m <- pms.munsell.lut[idx, ]
# simple display
colorContrastPlot(m1 = m$munsell[1], m2 = m$munsell[2], labels = m$code)
## 2. Munsell -> Pantone
colors <- c('723-c', '451-c')
# index / subset match
idx <- pms.munsell.lut$code %in% colors
m <- pms.munsell.lut[idx, ]
# simple display
colorContrastPlot(m1 = m$munsell[1], m2 = m$munsell[2], labels = m$code)
## 3. integration with SPC
data(pms.munsell.lut)
data(sp6)
depths(sp6) <- id ~ top + bottom
# get the closest Munsell chip from color meter data
sp6$munsell <- getClosestMunsellChip(sp6$color, convertColors = FALSE)
# prepare an intermediate data.frame for performing join to LUT
h <- horizons(sp6)[, c(hzidname(sp6), 'munsell')]
# left join
# not all Munsell colors have a paired Pantone color
m <- merge(h, pms.munsell.lut, by = 'munsell', all.x = TRUE, sort = FALSE)
# splice into original SPC
horizons(sp6) <- m
# graphical check
par(mar = c(0, 0, 2, 1))
plotSPC(sp6, color = 'hex')
## 4. multiple Pantone colors matching a single Munsell color
#
colors <- pms.munsell.lut[pms.munsell.lut$munsell == '5YR 5/5', ]
colors <- colors[order(colors$dE00), ]
par(mar = c(0, 0, 2, 0), fg = 'white', bg = 'black')
soilPalette(colors$hex, lab = colors$code)
title('Pantone Colors Roughly Matching 5YR 5/5', col.main = 'white', line = 0)
# }
Run the code above in your browser using DataLab