x: A vector or single-layer Raster, numeric or factor, for which a colour scale will be created
breaks: For colourScale either the number of or vector of breaks. for legendBreaks usually the output of colourScale, or a vector of breaks
style: Style for breaks, see Details
col: Colours to use, either a function or argument for brewer.pal
opacity: adds transparency to colours, either a single number, vector of length 2, or vector of same length as breaks
dec: Number of decimal places for the breaks
digits: Number of significant figures
firstBreak: If non-null, force the first break to take this value (often zero).
transform: A list of two functions to transform x and inverse transform the breaks, or a numeric value specifying a Box-Cox parameter.
revCol: Reverse the order of the colours.
exclude: A vector of values to change to NA when they appear in x
labels: Vector of names of levels, useful when style='unique'
multiples: break points must be multiples of these numbers times a power of 10
...: Additional arguments passed to classIntervals.
Details
colourScale produces intervals from x, each with a unique colour. Categories are determined with break points according to the following style options:
quantile: quantile(x, prob=seq(0,1,len=breaks), )
equal: seq(min(x), max(x), len=breaks)
unique: sort(table(unique(x)))[1:breaks]
fixed: breaks
any other string: is passed to classIntervals
colorScale passes all it's arguments to colourScale
breaksForRates returns break points suitable for mapping incidence rates, which are positive and always include 1.0.
Returns
A list with elements - plot: Vector of same length of x containing colours (RGB hex)
breaks: vector of break points
col: vector of unique colour values corresponding to breaks
colWithOpacity: as col, but with two digit transparency values appended.