colortable: colortable

Description Usage Arguments See Also Examples

View source: R/colortable.R

Description

Get or set the colortable of a RasterLayer. A colortable is a vector of 256 colors in the RGB triple format as returned by the rgb function (e.g. "#C4CDDA").

When setting the colortable, it is assumed that the values are integers in the range [0,255]

Usage

1
2
colortable(x)
colortable(x) <- value

Arguments

x

RasterLayer object

value

vector of 256 character values

See Also

plotRGB

Examples

1
2
3
4
5
6
r <- raster(ncol=10, nrow=10)
values(r) <- sample(0:255, ncell(r), replace=TRUE)
ctab <- sample(rainbow(256))
colortable(r) <- ctab
plot(r)
head(colortable(r)) 

Example output

Loading required package: sp
NOTE: rgdal::checkCRSArgs: no proj_defs.dat in PROJ.4 shared files
NOTE: rgdal::checkCRSArgs: no proj_defs.dat in PROJ.4 shared files
[1] "#C700FFFF" "#5C00FFFF" "#FF1E00FF" "#02FF00FF" "#B500FFFF" "#FF006CFF"

raster documentation built on Jan. 5, 2021, 3:01 a.m.