This function generates automatic comparison plots of pixel level or admin level population comparisons from the compare_pop (a raster brick), or the aggregate_to_shp (an sf object). If comparing a large number of rasters, you should be careful of memory requirements (a general guideline is that ncell(exe) * nlayers(exe) should not exceed 1e8, but this may be system dependent).

plot_compare(
  comp_obj,
  select_pops = NULL,
  type = "map",
  interactive = FALSE,
  save = FALSE,
  path = NULL,
  ext = "jpeg"
)

Arguments

comp_obj

sf or RasterBrick object generated by comparison functions (see Details)

select_pops

a numeric or character vector of either numeric indices or colum names, defaults to all population columns (i.e. ones with the prefix "popcmp")

type

character with option of the type of plots (all ggplots): "hex" (requires hexbin), "pairs" (requires GGally), "map" (requires and sf), and "hist". Defaults to "map".

interactive

logical, should the plot be returned as an interactive html plot using plotly? Defaults to FALSE.

save

logical, should the plot be saved rather than returned? Requires both path & ext params.

path

if save = TRUE, then the filepath to write the plot out to

ext

file extension (i.e. "jpeg", "png", "tiff")

Value

either a ggplot or a message stating where the ggplot was written out to.