nearestScheme: Use the nearest colour to a set of value-colour pairs.

Description Usage Arguments Details Value Author(s) Examples

View source: R/nearestScheme.R

Description

The nearest scheme takes a data frame of values and colours and produces a colour scheme function that maps data values to the colour corresponding to the nearest value in the data frame.

Usage

1
nearestScheme(valueColours)

Arguments

valueColours

a data frame with at least two columns, named 'col' and 'values'. The 'col' column must contain colour values and the 'values' column must be numeric.

Details

The numbers in the 'values' column should be unique, the returned colour is not clearly defined otherwise.

Value

A colourscheme function.

Author(s)

Barry Rowlingson <b.rowlingson@lancaster.ac.uk>

Examples

1
2
z=nearestScheme(data.frame(col=c("red","white","blue"),values=c(1,2,3)))
z(seq(0,4,len=6))

colourschemes documentation built on May 2, 2019, 4:56 p.m.