Skip to content

problem with plotting .pngs with the rasterVis package

2 messages · Maximilian Reinwand, Oscar Perpiñan

#
Hi, 

I think you would find useful the "layout" argument of levelplot:

library(raster)
library(rasterVis)

r <- raster(nrows=10, ncols=10)
r <- setValues(r, 1:ncell(r))
s <- stack(r,r*2)
s2 <- stack(s, s, s)*rep(1:3, each=2)

trellis.device(pdf, file='test.pdf')
levelplot(s2, layout=c(2, 1))
dev.off()

By the way, if you use levelplot inside a for loop, you have to print
it:

for (i in 1:3){print(levelplot(s*i))}

Best,

Oscar.

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

http://procomun.wordpress.com

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