Learn R Programming

ternvis (version 1.2)

tcolour: Assign a colour to a ternary forecast

Description

Function to assign a colour to a ternary forecast p, given a ternary climatology q.

Usage

tcolour(p = cbind(1, 1, 1)/3, q = cbind(1, 1, 1)/3, m = 0.7, 
        flip = FALSE, dich = "none", theta0 = 0)

Value

A colour, of the format produced by rgb.

Arguments

p

An n-by-3 matrix of ternary forecasts.

q

A 1-by-3 matrix containing the climatology.

m

Exponent controlling rate of colour saturation.

flip

Logical to transpose categories "B" and "A" in barycentric coordinates.

dich

Option to render colours as they would appear to a dichromat. Default choice dich = "none" leaves colours unchanged. Choices dich = "deutan" and dich = "protan" show colours as they would appear to those with deutanopia or protanopia (see dichromat).

theta0

Angle (degrees) through which to rotate colour palette around climatology q in barycentric coordinates.

Author

Tim Jupp

References

Jupp TE, Lowe R, Stephenson DB, Coelho CAS (2012) On the visualization, verification and recalibration of ternary probabilistic forecasts, Philosophical Transactions of the Royal Society, volume 370, pages 1100-1120.

http://rsta.royalsocietypublishing.org/content/370/1962/1100.full

http://arxiv.org/abs/1103.1303

Examples

Run this code
p <- cbind(0.7,0.2,0.1)   # define a forecast
q <- cbind(1,1,1)/3       # define a climatology
pcol <- tcolour(p=p,q=q)  # assign a colour
pcol                      # print the colour code to terminal
tplot(p,col=pcol)         # use this colour in a plot

Run the code above in your browser using DataLab