interpolatePalette {tractor.base}R Documentation

Functions for working with colour scales or palettes

Description

The getColourScale function can be used to obtain a standard or customised colour scale for use in the package's image visualisation functions. A graded palette of colours between two or more key colours can be obtained using interpolatePalette.

Usage

interpolatePalette(colours, n, ...)

getColourScale(n)

Arguments

colours

A vector of colours to interpolate between, using any format recognised by colours.

n

For getColourScale, a number, colour name or list (see Details). For interpolatePalette, a single integer specifying the length of the interpolated palette.

...

Additional arguments to colorRamp.

Details

Colour scales can be specified in any of three ways. Firstly, by a single number, representing a predefined colour scale. Currently valid values are 1 (greyscale, black background), 2 (red to yellow heat scale, red background), 3 (blue to red rainbow scale, blue background), 4 (blue to white to red diverging scale, white background), 5 (white to red, white background) and 6 (white to blue, white background). Secondly, a single colour name can be given (see colours); in this case the background will be black. This is useful for binary images. Thirdly and most flexibly, a list with two named elements can be given: colours, a vector of colours representing the colour scale, perhaps created using rgb; and background, a single colour representing the background.

Value

For getColourScale, a list with elements

colours

A character-mode vector representing the colours in the scale, usually of length 100. This can be passed as a colour scale to R's plotting functions.

background

A single character string representing the background colour.

The interpolatePalette function returns a character-mode vector representing the colours in the interpolated scale.

Author(s)

Jon Clayden

References

Please cite the following reference when using TractoR in your work:

J.D. Clayden, S. Muñoz Maniega, A.J. Storkey, M.D. King, M.E. Bastin & C.A. Clark (2011). TractoR: Magnetic resonance imaging and tractography with R. Journal of Statistical Software 44(8):1-18. http://www.jstatsoft.org/v44/i08/.

See Also

colours, rgb, colorRamp

Examples


getColourScale(1)

interpolatePalette(c("red","yellow"), 10)


[Package tractor.base version 3.1.0 Index]