| default.colourmap | R Documentation |
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"))
x |
A vector of atomic values, or a factor. |
col |
Optional. A specification of colours to be used. See Details. |
scramble.cols |
Logical value. If |
monochrome |
Logical value. If |
... |
Additional arguments passed to methods. |
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.
A colour map (object of class "colourmap").
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.
colourmap
default.colourmap(letters[1:4])
default.colourmap(factor(letters[1:3], levels=letters[1:4]))
default.colourmap(TRUE)
default.colourmap(NULL)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.