huePosition {aqp} | R Documentation |
Munsell Hue Reference and Position Searching
Description
The 40 Munsell hues are typically arranged from 5R to 2.5R moving clock wise on the unit circle. This function matches a vector of hues to positions on that circle, with options for setting a custom origin or search direction.
This function is fully vectorized.
Usage
huePosition(
x,
returnHues = FALSE,
includeNeutral = FALSE,
origin = "5R",
direction = c("cw", "ccw")
)
Arguments
x |
character vector of hues, e.g. c('10YR', '5YR'), optional if |
returnHues |
logical, should the full set of Munsell hues be returned? See details. |
includeNeutral |
logical, add 'N' to the end of the full set of Munsell hues |
origin |
hue to be used as the starting point for position searches (position 1) |
direction |
indexing direction, should be |
Value
A vector of integer hue positions is returned, of the same
length and order as x
. If returnHues = TRUE
, then all hue
names and ordering are returned and x
is ignored.
Author(s)
D.E. Beaudette
References
Soil Survey Technical Note 2 wayback machine URL
Munsell book of color. 1976. Macbeth, a Division of Kollmorgen Corp., Baltimore, MD.
See Also
colorContrast, huePositionCircle
Examples
# get hue ordering for setting levels of a factor
huePosition(returnHues = TRUE)
# get hue ordering including N (neutral)
huePosition(returnHues = TRUE, includeNeutral = TRUE)
# get position of the '10YR' hue, relative to standard origin of '5R'
# should be 7
huePosition(x = '10YR')
# get position of the '10YR' hue, relative to standard origin of '5YR'
# should be 3
huePosition(x = '10YR', origin = '5YR')
# visualize
op <- par(mar = c(0, 0, 0, 0), fg = 'white', bg = 'black')
huePositionCircle(huePosition(returnHues = TRUE, origin = '5YR'))
par(op)