Learn R Programming

spatstat.geom (version 3.2-5)

interp.colourmap: Interpolate smoothly between specified colours

Description

Given a colourmap object which maps numbers to colours, this function interpolates smoothly between the colours, yielding a new colour map.

Usage

interp.colourmap(m, n = 512)

Value

Another colour map (object of class "colourmap").

Arguments

m

A colour map (object of class "colourmap").

n

Number of colour steps to be created in the new colour map.

Author

Adrian Baddeley Adrian.Baddeley@curtin.edu.au and Rolf Turner r.turner@auckland.ac.nz

Details

Given a colourmap object m, which maps numerical values to colours, this function interpolates the mapping, yielding a new colour map.

This makes it easy to build a colour map that has smooth gradation between different colours or shades. First specify a small vector of numbers x which should be mapped to specific colours y. Use m <- colourmap(y, inputs=x) to create a colourmap that represents this simple mapping. Then apply interp.colourmap(m) to obtain a smooth transition between these points.

See Also

colourmap, tweak.colourmap, colourtools.

Examples

Run this code
  co <- colourmap(inputs=c(0, 0.5, 1), c("black", "red", "white"))
  plot(interp.colourmap(co))

Run the code above in your browser using DataLab