Skip to content
Prev 12771 / 29559 Next

spplot for raster not drawn

Hi,

Another approach is to use the layout argument of levelplot. 

As an example, I use the data from Cressie and Wikle, following the
superb Edzer Pebesma's notes in demo/CressieWikle.R in the 
spacetime package.

Best, 

Oscar.

library(raster)
library(rasterVis)
library(zoo)

url <- "ftp://ftp.wiley.com/public/sci_tech_med/spatio_temporal_data/"

sst.dat = read.table(paste(url, "SST011970_032003.dat", sep=''), header
	= FALSE) 
sst.ll = read.table(paste(url, "SSTlonlat.dat", sep=''),
	header = FALSE)

sp <- SpatialPointsDataFrame(sst.ll, sst.dat)
gridded(sp) <- TRUE
proj4string(sp) = "+proj=longlat +datum=WGS84"
s <- brick(sp)

idx <- seq(as.Date('1970-01-01'), as.Date('2003-03-01'), by='month')
idx <- as.yearmon(idx)
s <- setZ(s, idx)
layerNames(s) <- as.character(idx)

##One year per page with layout=c(3,4)
trellis.device('pdf', file='cressie_level.pdf')
levelplot(s, layout=c(3, 4))
dev.off()

## layout inside histogram works correctly 
## only with rasterVis 0.10-5 (at R-Forge) 
trellis.device('pdf', file='cressie_hist.pdf')
histogram(s, layout=c(3, 4))  
dev.off()



-------------------
Oscar Perpi??n Lamigueiro
Dpto. Ingenier?a El?ctrica
EUITI-UPM

http://procomun.wordpress.com

-----------------------------------------