getColoursGrainType: Gets colours for plotting snow grain types

View source: R/getColoursGrainType.R

getColoursGrainTypeR Documentation

Gets colours for plotting snow grain types

Description

Grain colours are defined in the grainDict data.frame and the definitions can be changed with setColoursGrainType

Usage

getColoursGrainType(Grains, grainDict. = grainDict)

Arguments

Grains

grain type (character or list of characters)

grainDict.

lookup table to use. Note, the easiest and best way to do this is via setColoursGrainType. This input variable here is only a hack to change the grainDict explicitly when calling plot.snowprofile via Col, and beforehand computing Col = Col <- sapply(Profile$layers$gtype, function(x) getColoursGrainType(x, grainDict = setColoursGrainType('sarp-reduced'))); This is only necessary in specific environments (e.g. a shiny app)

Value

Array with HTML colour codes

Author(s)

phaegeli, shorton, fherla

See Also

setColoursGrainType, getColoursDensity, getColoursGrainSize, getColoursHardness, getColoursLWC, getColoursSnowTemp

Examples


Grains <- c('PP', 'DF', 'RG', 'FC', 'FCxr', 'DH', 'SH', 'MF', 'MFcr', 'IF')
Colours <- getColoursGrainType(Grains)
Colours

plot(1:length(Grains), col = Colours, pch = 20, cex = 3)
text(1:length(Grains), 1:length(Grains), Grains, pos = 1)


sarp.snowprofile documentation built on March 31, 2023, 5:17 p.m.