Determines a colour map for plotting a spatial pattern (or other data) when one is not supplied by the user.
default.colourmap(x, ...,
col=spatstat.options("image.colfun"),
scramble.cols=FALSE,
monochrome=spatstat.options("monochrome"))A colour map (object of class "colourmap").
A vector of atomic values, or a factor.
Optional. A specification of colours to be used. See Details.
Logical value. If TRUE, the sequence of colour values
will be randomly permuted.
Logical value. If TRUE, the colours will be converted
to greyscale colours.
Additional arguments passed to methods.
The argument scramble.cols=TRUE
will cause the sequence of colours in the colour map to be
randomly permuted. This is a useful trick when it is desired that
adjacent colours in the sequence should be easily distinguishable.
The return value will be the randomised colour map.
Randomisation implies that the colour map will be different
each time the command is executed. For reproducible results,
set the random generator seed using set.seed.
Adrian Baddeley Adrian.Baddeley@curtin.edu.au
In the spatstat package, an object of class "colourmap"
defines a mapping between data and colours.
The function default.colourmap provides a suitable default
colour map for the values in x.
If x is a factor, default.colourmap(x) is a mapping
from the factor levels to colours.
If x is a logical vector, default.colourmap(x) is a mapping
from the values TRUE and FALSE to colours.
If x is a numeric vector, default.colourmap(x) is a
mapping from numbers in the interval between the minimum and maximum values of
x to colours.
The argument col may provide colour information
in any of the following formats:
A colour map (object of class "colourmap")
A palette function (a function(n) or function(n, ...)
which returns a vector of colour values,
such as rainbow
A vector of integers between 1 and 8 indexing the standard colour palette
A vector of character strings giving common names of colours
(e.g. "red")
A vector of character strings giving hexadecimal codes for
colours (e.g. produced by rgb
or rainbow)
NULL.
colourmap
default.colourmap(letters[1:4])
default.colourmap(factor(letters[1:3], levels=letters[1:4]))
default.colourmap(TRUE)
default.colourmap(NULL)
Run the code above in your browser using DataLab