Reproducible example (fig01 from rspatial):
library(sp)
library(lattice)
data(meuse)
coordinates(meuse)=~x+y
spplot(meuse, "zinc", do.log = TRUE,
key.space=list(x=0.2,y=0.9,corner=c(0,1)),
scales=list(draw=T))
Now, I would like to make the same plot with a transparent rectangle which boundaries are specified in terms of the "native" units of the data coordinates (different from this answer):
spplot(meuse, "zinc", do.log = TRUE,
key.space=list(x=0.2,y=0.9,corner=c(0,1)),
scales=list(draw=T),
panel=function(){
panel.rect(xleft=180000, ybottom=330000,
xright=181000, ytop=330500, alpha=1)
})
However, I end up with a new plot without the data points: