Learn R Programming

soilprofile (version 1.0)

munsell_to_rgb: Converts munsell colors to RGB colors

Description

This funcion converts a vector of munsell colors in the form hue value/chroma into an RGB R color. Vectors are passed to 'as.character' for conversion. Hue and chroma must be strictly separated by a space, whereas chroma and value by a '/'. It is internally called in the 'plot.profile.data.frame' function.

Usage

munsell_to_rgb(color, name)

Arguments

color
A string or vector containing Munsell color(s) in the form Hue value/chroma.
name
This argument is taken in the workflow of the 'plot.data.frame' function, with the purpose to give the horizon name in case of warning.

Value

  • A vector of R colors

Details

The function separates Hue, value and chroma by calling 'substr' and then calls the function munsell2rgb {aqp} for the conversion into R colors. If the color is not existing (be either because of wrong separation between Hue value and chroma, or unexisting munsell color), it defaults to '#39302CFF' and returns a warning.

Examples

Run this code
##a 5Y 5/3 (dark brown) boxplot
boxplot(1:10, col=munsell_to_rgb(example[[6]][1]), main='A 5Y 5/3 (dark brown) boxplot')

Run the code above in your browser using DataLab