How can I assign a specific color to NA values of a raster when plotting it with the levelplot function from R-package rasterVis? I am searching for a similar functionality as "colNA".
levelplot
uses the background color to display the NA
values. Thus, you have to modify this color using panel.background
.
library(rasterVis)
myTheme <- BTCTheme()
myTheme$panel.background$col = 'gray'
f <- system.file("external/test.grd", package="raster")
r <- raster(f)
levelplot(r, par.settings = myTheme)