##' @import ggplot2
##' @import maps
##' @import PBSmapping
##' @importFrom data.table setnames
##' @export plot raster_resample
plot.raster_resample <- function(x, ...) {
n <- length(x)
.x <- Reduce(rbind, x)
world <- map_data("world")
xlim <- range(.x$lon)
ylim <- range(.x$lat)
data.table::setnames(world, c("X","Y","PID","POS","region","subregion"))
world <- clipPolys(world, xlim = xlim, ylim = ylim, keepExtra = TRUE)
for (i in 1:n) {
gg <- ggplot(x[[i]], aes(x = lon, y = lat, colour = factor(cell)), ...) +
geom_point() +
coord_quickmap() +
geom_polygon(data = world, aes(x = X, y = Y, group = PID),
colour = "black", fill = "white", alpha = 0) +
theme_minimal()
print(gg)
cat ("Press [enter] for next plot")
line <- readline()
}
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.