huePosition | R Documentation |
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.
huePosition(
x,
returnHues = FALSE,
includeNeutral = FALSE,
origin = "5R",
direction = c("cw", "ccw")
)
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 |
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.
D.E. Beaudette
Soil Survey Technical Note 2 wayback machine URL
Munsell book of color. 1976. Macbeth, a Division of Kollmorgen Corp., Baltimore, MD.
colorContrast, huePositionCircle
# 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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.