From 2d8dad2f52d08097f62a5be129a78165f1fb04cf Mon Sep 17 00:00:00 2001 From: nperez Date: Mon, 25 May 2020 15:28:48 +0200 Subject: [PATCH 1/4] Fixed Mask rearrangement --- R/PlotCombinedMap.R | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/R/PlotCombinedMap.R b/R/PlotCombinedMap.R index 96784eb8..47e74466 100644 --- a/R/PlotCombinedMap.R +++ b/R/PlotCombinedMap.R @@ -349,9 +349,19 @@ PlotCombinedMap <- function(maps, lon, lat, # Add overplot on top #---------------------- if (!is.null(mask)) { + dims_mask <- dim(mask) + latb <- sort(lat, index.return = TRUE) + dlon <- lon[2:dims_mask[2]] - lon[1:(dims_mask[2] - 1)] + wher <- which(dlon > (mean(dlon) + 1)) + if (length(wher) > 0) { + lon[(wher + 1):dims_mask[2]] <- lon[(wher + 1):dims_mask[2]] - 360 + } + lonb <- sort(lon, index.return = TRUE) + cols_mask <- sapply(seq(from = 0, to = 1, length.out = 10), function(x) adjustcolor(col_mask, alpha.f = x)) - image(lon, lat, t(mask), axes = FALSE, col = cols_mask, + image(lonb$x, latb$x, t(mask)[lonb$ix, latb$ix], + axes = FALSE, col = cols_mask, breaks = seq(from = 0, to = 1, by = 0.1), xlab='', ylab='', add = TRUE, xpd = TRUE) if (!exists('coast_color')) { -- GitLab From 8fba0b95d8da3c4b649a4782689a0320963ec5aa Mon Sep 17 00:00:00 2001 From: nperez Date: Mon, 25 May 2020 15:37:18 +0200 Subject: [PATCH 2/4] Example to PlotCombined using mask --- R/PlotCombinedMap.R | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/R/PlotCombinedMap.R b/R/PlotCombinedMap.R index 47e74466..7f8f5d64 100644 --- a/R/PlotCombinedMap.R +++ b/R/PlotCombinedMap.R @@ -43,7 +43,17 @@ #' display_range = c(0, 1), #' bar_titles = paste('% of belonging to', c('a', 'b', 'c')), #' brks = 20, width = 10, height = 8) - +#' +#'Lon <- c(0:40, 350:359) +#'Lat <- 51:26 +#'data <- rnorm(51 * 26 * 3) +#'dim(data) <- c(map = 3, lon = 51, lat = 26) +#'mask <- sample(c(0,1), replace = TRUE, size = 51 * 26) +#'dim(mask) <- c(lat = 26, lon = 51) +#'PlotCombinedMap(data, lon = Lon, lat = Lat, map_select_fun = max, +#' display_range = range(data), mask = mask, +#' width = 12, height = 8) +#' #'@export PlotCombinedMap <- function(maps, lon, lat, map_select_fun, display_range, -- GitLab From da11eb76a81e62e15bf02126333778dc20f5a623 Mon Sep 17 00:00:00 2001 From: nperez Date: Thu, 11 Jun 2020 14:38:12 +0200 Subject: [PATCH 3/4] devtools automatic documenation update PlotCombinedMap --- man/PlotCombinedMap.Rd | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/man/PlotCombinedMap.Rd b/man/PlotCombinedMap.Rd index 616b84f9..c45d1afb 100644 --- a/man/PlotCombinedMap.Rd +++ b/man/PlotCombinedMap.Rd @@ -82,6 +82,17 @@ PlotCombinedMap(list(a, b, c), lons, lats, display_range = c(0, 1), bar_titles = paste('\% of belonging to', c('a', 'b', 'c')), brks = 20, width = 10, height = 8) + +Lon <- c(0:40, 350:359) +Lat <- 51:26 +data <- rnorm(51 * 26 * 3) +dim(data) <- c(map = 3, lon = 51, lat = 26) +mask <- sample(c(0,1), replace = TRUE, size = 51 * 26) +dim(mask) <- c(lat = 26, lon = 51) +PlotCombinedMap(data, lon = Lon, lat = Lat, map_select_fun = max, + display_range = range(data), mask = mask, + width = 12, height = 8) + } \seealso{ \code{PlotCombinedMap} and \code{PlotEquiMap} -- GitLab From c2bec810f4f25c47cb281c1644774d491f26c76c Mon Sep 17 00:00:00 2001 From: nperez Date: Thu, 11 Jun 2020 14:39:22 +0200 Subject: [PATCH 4/4] Fix in PlotCombinedMap added to NEWS --- NEWS.md | 1 + 1 file changed, 1 insertion(+) diff --git a/NEWS.md b/NEWS.md index bbb9a496..2a9cffb6 100644 --- a/NEWS.md +++ b/NEWS.md @@ -13,6 +13,7 @@ + RainFARM checks 'slope' is not a vector + DESCRIPTION specifies the minimum multiApply version required + EnsClustering has a fixed 'closest_member' output + + PlotCombinedMap handles masks correctly ### CSTools 3.0.0 **Submission date to CRAN: 10-02-2020** -- GitLab