r <- raster(system.file("external/test.grd", package="raster"))
s <- stack(r, r*2)
names(s) <- c('meuse', 'meuse x 2')
spplot(s)
pts <- data.frame(sampleRandom(r, 10, xy=TRUE))
coordinates(pts) <- ~ x + y
spplot(s, scales = list(draw = TRUE),
xlab = "easting", ylab = "northing",
col.regions = rainbow(99, start=.1),
names.attr=c('original', 'times two'),
sp.layout = list("sp.points", pts, pch=20, cex=2, col='black'),
par.settings = list(fontsize = list(text = 12)), at = seq(0, 4000, 500))
Run the code above in your browser using DataLab