I use RasterVis and levelplot to create a trellised graph of some rasters. I am currently approved for most things, but I would like to change the title for each panel from the file name to the selected line (the file name is confusing and long, I want to use only a year, like "2004").
Looking at the levelplot page , this will mean that the levelplot is looking for some settings according to the 'useRaster' argument, or it goes to panel.levelplot or panel.levelplot.raster , but I try to use these last functions.
Any help is much appreciated, here are some sample code;
require(rasterVis)
layers <- c(1:4)
s2 <- stack()
for (i in layers) {
r <- raster(nrows=100, ncols=100,ext)
r[] <- sample(seq(from = 1, to = 6, by = 1), size = 10000, replace = TRUE)
rasc <- ratify(r)
rat <- levels(rasc)[[1]]
rat$legend <- c("A","B","C","D","E","F")
levels(rasc) <- rat
s2 <- stack(s2, rasc)
}
levelplot(s2, col.regions=rev(terrain.colors(6)),main = "example")
, , , "layer.1.1" "2004" .. 2007