Skip to content
Prev 12510 / 29559 Next

Transparency of Raster* objects

Hi,

You can also use the "overlaying" mechanism of latticeExtra, 
with the levelplot method of rasterVis:

library(raster)
library(rasterVis)
library(lattice)
library(latticeExtra)

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

data(meuse.grid)
coordinates(meuse.grid) <- ~x+y
proj4string(meuse.grid) <- CRS("+init=epsg:28992")
gridded(meuse.grid) <- TRUE
d <- raster(meuse.grid, 'dist')

rPlot <- levelplot(r)
dPlot <- levelplot(d, par.settings=GrTheme, alpha.regions=0.4)

rPlot + dPlot

Besides, you can also add contour lines:

## In the next version of rasterVis a new contourplot method will be
## added as a wrapper to levelplot with these options.
dContour <- levelplot(d, region=FALSE, labels=TRUE, contour=TRUE,
			pretty=TRUE, colorkey=FALSE)

rPlot + dContour

rPlot + dPlot + dContour

Best,

Oscar.

El Fri, 29 Jul 2011
01:50:49 -0700 (PDT) Robert Hijmans <r.hijmans at gmail.com> escribi?: