Add north arrow and scale in levelplot outside the plot

100 Views Asked by At

I plotted five grids A-E as a Raster Brick with the levelplot function. To do this, I added a north arrow and a scalebar. I would like to have a north arrow and scalebar for all grids outside the plot. Can anyone help? Would be great, when the x and y scale should a distance in meters instead of the coordinates. The cellsize is 1mx1m.enter image description here

p <- rasterVis::levelplot(Brick, margin = FALSE, 
                          names.attr = c("A","B", "C", "D","E"),
                          col.regions = terrain.colors, pretty = TRUE, contour = TRUE, 
                          xlab = bquote(bold("Lat")), ylab = bquote(bold("Long")),
                          xlim=c(611394,611420), ylim=c(5787145,5787286),
                          at = seq(-0.1, 15, by = 1), colorkey=ckey, scales=list(draw=FALSE))
p <- p  + layer({SpatialPolygonsRescale(layout.north.arrow(),offset = c(611400,5787160),scale = 14)})
p <- p  + layer({
  xs <- seq(611400, 611420, by=10)
  grid.rect(x=xs, y=5787155,
            width=10, height=2,
            gp=gpar(fill=rep(c('transparent', 'black'), 2)),
            default.units='native')
  grid.text(x= xs - 5, y=5787160, seq(0, 30, by=10),
            gp=gpar(cex=0.5), rot=30,
            default.units='native')
})
p <- p + latticeExtra::layer(panel.text(c(1:40), x=Bonitur$Lat, y=Bonitur$Long, cex=1, font=2))
p
0

There are 0 best solutions below