The general point of this function is to automatically generate a mapping that can be used in combination with cmap
to represent numeric data with colors in a consistent way.
colFn
should be a function that returns a vector of colors of specified length, such as rainbow
, greyscale
. Custom functions of this type can be generated with colorRampPalette
.
The breakpoints can be specified explicitly by setting breaks
to a vector of numbers, in which case x
is ignored. Otherwise, the breakpoints are chosen to be nice, relatively round values (using pretty
, or another function passed to breaks
) covering the finite range of x
.
If symm
is TRUE, the map domain is extended such that it is symmetric around zero. This can be useful when using divergent color palettes to ensure that the zero point is a neutral color.
If base
is specified, the breakpoints are generated using log-transformed data. However, setting breaks = prettyLog
might be preferable.