I have a raster stack that I want to plot in rasterVis:levelplot (only because there seems no simple alternative like using ggplot). However, I fail to increase the size of the text.
Ideally I would like to assign names to individual "layers" before plotting (see code below). However, this doesn't seem to allow me to change the text size. If I create an object with the layer names, the default names are still plotted (and it also replaces spaces with full stops.)
## Load libraries
library(raster)
library(rasterVis)
## make raster 1
r1 = raster(ext=extent(c(-69.5, -56, -56, -49)), res=c(0.5, 0.5)) #lat/long xmin, xmax, ymin, ymax # global fishing watch data
r1[] <- c(1,3,4,5)
projection(r1) <- "+proj=longlat +datum=WGS84 +no_defs +ellps=WGS84 +towgs84=0,0,0"
crs(r1) <- "+proj=longlat +datum=WGS84 +no_defs +ellps=WGS84 +towgs84=0,0,0"
## make raster 2
r2 = raster(ext=extent(c(-69.5, -56, -56, -49)), res=c(0.5, 0.5)) #lat/long xmin, xmax, ymin, ymax # global fishing watch data
r2[] <- c(2,5,7,8)
projection(r1) <- "+proj=longlat +datum=WGS84 +no_defs +ellps=WGS84 +towgs84=0,0,0"
crs(r1) <- "+proj=longlat +datum=WGS84 +no_defs +ellps=WGS84 +towgs84=0,0,0"
## make rasterStack
s <- stack(r1, r2)
## assign names to each raster layer
names(s) <- c("My raster 1", "My raster 2")
## plot rasterStack with rasterVis::levelplots
col <- rev(heat.colors(999))
p <- levelplot(s, col.regions=col, main=list(cex=0.5))
p
## increase size of the headings
p <- levelplot(s, col.regions=col, main=list(cex=2))
p
# no change...
## try this alternative
raster.names <- c("My raster 1", "My raster 2")
p <- levelplot(s, col.regions=col, main=list(raster.names, cex=2))
p
# nope... :-(