I have plotted a stack of raster using the function 'levelplot' script as below:
library(raster)
library(rasterVis)
ras <- list.files("/filepath/", pattern = "\\.tif$", full=TRUE)
s <- stack(ras)
> levelplot(s, colorkey = list(space ="bottom",height=1, width=1),
names.attr=c("2011","2012","2013", "2014")))
The problem with the plot is that the label of x-axis label 'Longitude' overlaps with the colorbar/ colorkeys of the plot. Is it possible to move the position of colorkeys a little below the label 'Longitude'?
Thanks
You can adjust this with the vjust
parameter in the xlab
list ...
levelplot(s, colorkey = list(space = "bottom", height = 1, width = 1),
names.attr = c("2011", "2012", "2013", "2014"),
xlab = list(label = "Longitude", vjust = -.2)))