diff --git a/R/VizCombinedMap.R b/R/VizCombinedMap.R index 5119385ae254354fe9ed69134d5b901764ec8e60..2fdae198e1008b1240a88e71a514859dda086a61 100644 --- a/R/VizCombinedMap.R +++ b/R/VizCombinedMap.R @@ -149,9 +149,11 @@ VizCombinedMap <- function(maps, lon, lat, plot_margin = NULL, bar_extra_margin = c(2, 0, 2, 0), fileout = NULL, width = 8, height = 5, size_units = 'in', res = 100, drawleg = T, return_leg = FALSE, - ...) { + ...) { args <- list(...) - + country.borders <- if (!is.null(args$country.borders)) args$country.borders else FALSE + args$country.borders <- NULL # Prevent duplication + # If there is any filenames to store the graphics, process them # to select the right device if (!is.null(fileout)) { @@ -461,10 +463,15 @@ VizCombinedMap <- function(maps, lon, lat, if (is.null(plot_margin)) { plot_margin <- c(5, 4, 4, 2) + 0.1 # default of par()$mar } - - VizEquiMap(var = ml_map, lon = lon, lat = lat, - brks = tbrks, cols = tcols, drawleg = FALSE, - filled.continents = FALSE, dots = dots, margin_scale = plot_margin, ...) + + country.borders.VizEquiMap <- if (!is.null(mask)) FALSE else country.borders + + do.call(VizEquiMap, c(list( + var = ml_map, lon = lon, lat = lat, + brks = tbrks, cols = tcols, drawleg = FALSE, + filled.continents = FALSE, country.borders = country.borders.VizEquiMap, + dots = dots, margin_scale = plot_margin + ), args)) #---------------------- # Add overplot on top @@ -489,9 +496,22 @@ VizCombinedMap <- function(maps, lon, lat, coast_color <- 'black' } if (min(lon) < 0) { - map('world', interior = FALSE, add = TRUE, lwd = 1, col = coast_color) # Low resolution world map (lon -180 to 180). + map('world', interior = country.borders, add = TRUE, lwd = 1, col = coast_color) # Low resolution world map (lon -180 to 180). } else { - map('world2', interior = FALSE, add = TRUE, lwd = 1, col = coast_color) # Low resolution world map (lon 0 to 360). + map('world2', interior = country.borders, add = TRUE, lwd = 1, col = coast_color) # Low resolution world map (lon 0 to 360). + } + if (!is.null(args$shapefile)) { + if (is.list(args$shapefile)) { + shape <- args$shapefile + } else { + shape <- readRDS(file = args$shapefile) + } + shapefile_color <- if (!is.null(args$shapefile_color)) args$shapefile_color else "black" + shapefile_lwd <- if (!is.null(args$shapefile_lwd)) args$shapefile_lwd else 1 + filled.continents <- if (!is.null(args$filled.continents)) args$filled.continents else FALSE + maps::map(shape, interior = country.borders, #wrap = wrap_vec, + fill = filled.continents, add = TRUE, plot = TRUE, + lwd = shapefile_lwd, col = shapefile_color) } box() } diff --git a/R/VizMostLikelyQuantileMap.R b/R/VizMostLikelyQuantileMap.R index 1796e392521451f51c9b438c6ba5ca8aee6f5297..a756b4eb6919d84ea8ab1201a534573e0156a0bb 100644 --- a/R/VizMostLikelyQuantileMap.R +++ b/R/VizMostLikelyQuantileMap.R @@ -39,8 +39,8 @@ #' 'right', 'r', 'R', 'east', 'e', 'E'\cr #' 'left', 'l', 'L', 'west', 'w', 'W' #'@param ... Additional parameters to be sent to \code{VizCombinedMap} and -#' \code{PlotEquiMap}. -#'@seealso \code{VizCombinedMap} and \code{PlotEquiMap} +#' \code{VizEquiMap}. +#'@seealso \code{VizCombinedMap} and \code{VizEquiMap} #'@examples #'# Simple example #'x <- array(1:(20 * 10), dim = c(lat = 10, lon = 20)) / 200