[R-sig-Geo] rasterVis levelplot: Use colortable in raster with attribute table

AdamWilson adammichaelwilson2 at gmail.com
Wed Jun 11 15:56:55 CEST 2014

It's possible to use the colortable metadata in levelplot like this:

f <- system.file("external/test.grd", package="raster")
r <- round(raster(f))

## assign a color table
## if the original raster (on disk) had a color table it should already be
in this slot
r at legend@colortable=rainbow(cellStats(r,max))

## 'normal' levelplot

## use the color table instead. Could write a simple wrapper function for
## this might not work for all color tables....
cols=r at legend@colortable

View this message in context: http://r-sig-geo.2731867.n2.nabble.com/rasterVis-levelplot-Use-colortable-in-raster-with-attribute-table-tp7585716p7586573.html
Sent from the R-sig-geo mailing list archive at Nabble.com.

More information about the R-sig-Geo mailing list