# Change the eval option to TRUE to show the plots knitr::opts_chunk$set(warning = TRUE, message = FALSE, collapse = TRUE, comment = "#>", out.width = "75%", dpi = 600, fig.asp = 1 / 1.6, fig.width = 5, fig.retina = NULL, echo = TRUE, eval = FALSE)
Plot the constructed population grid and, optionally, the initial sampling locations.
library("reemsplots2") library("ggplot2") mcmcpath <- system.file("extdata", "EEMS-example", package = "reemsplots2") longlat <- TRUE plots <- plot_population_grid(mcmcpath, longlat) names(plots) plots$popgrid
# In this case the datapath is the same as the mcmcpath # because all package data is in the "extdata" folder datapath <- system.file("extdata", "EEMS-example", package = "reemsplots2") # Load the sampling coordinates coord <- read.table(paste0(datapath, ".coord"), header = FALSE) # Name the columns appropriately if (longlat) { colnames(coord) <- c("long", "lat") } else { colnames(coord) <- c("lat", "long") } plots$popgrid + geom_point(data = coord, aes(x = long, y = lat), shape = 1)
Unlike the other plotting functions, we can use plot_population_grid
even if EEMS throws the following error:
The population grid is not connected.
mcmcpath <- system.file("extdata", "EEMS-popgrid", package = "reemsplots2") plots <- plot_population_grid(mcmcpath, longlat = FALSE) plots$popgrid
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.