From 14757ac54204f1cf7cb74c6aa8550059cceca70a Mon Sep 17 00:00:00 2001 From: Jorge Bano Medina Date: Mon, 1 Mar 2021 18:07:15 +0100 Subject: [PATCH] example hatching spatialPlot --- R/spatialPlot.R | 14 ++++++++++++++ man/spatialPlot.Rd | 14 ++++++++++++++ 2 files changed, 28 insertions(+) diff --git a/R/spatialPlot.R b/R/spatialPlot.R index 62531fb..fb4e7a2 100644 --- a/R/spatialPlot.R +++ b/R/spatialPlot.R @@ -88,6 +88,7 @@ #' @examples \donttest{ #' require(transformeR) #' require(climate4R.datasets) +#' require(sp) #' data("CFS_Iberia_tas") #' # Climatology is computed: #' clim <- climatology(CFS_Iberia_tas, by.member = TRUE) @@ -170,6 +171,19 @@ #' backdrop.theme = "countries", #' color.theme = "BrBG", #' rev.colors = TRUE, cex = 2.5) +#' +#' # Station data (hatching): +#' data("VALUE_Iberia_pr") +#' # Just as an example, stations with a precip climatology lower than 3mm/day +#' ind <- which(climatology(VALUE_Iberia_pr)$Data < 3) +#' spatialPlot(climatology(VALUE_Iberia_pr), +#' backdrop.theme = "countries", +#' colorkey = TRUE, +#' sp.layout = list(list("sp.points", +#' SpatialPoints(VALUE_Iberia_pr$xyCoords[ind,]), pch = 4, cex = 1.5, +#' first = FALSE, col = "black"))) +#' +#' #' } diff --git a/man/spatialPlot.Rd b/man/spatialPlot.Rd index 1ead707..3413127 100644 --- a/man/spatialPlot.Rd +++ b/man/spatialPlot.Rd @@ -81,6 +81,7 @@ Some examples of specific map graphical options are available in the help of fun \donttest{ require(transformeR) require(climate4R.datasets) +require(sp) data("CFS_Iberia_tas") # Climatology is computed: clim <- climatology(CFS_Iberia_tas, by.member = TRUE) @@ -163,6 +164,19 @@ spatialPlot(climatology(VALUE_Iberia_pr), backdrop.theme = "countries", color.theme = "BrBG", rev.colors = TRUE, cex = 2.5) + +# Station data (hatching): +data("VALUE_Iberia_pr") +# Just as an example, stations with a precip climatology lower than 3mm/day +ind <- which(climatology(VALUE_Iberia_pr)$Data < 3) +spatialPlot(climatology(VALUE_Iberia_pr), + backdrop.theme = "countries", + colorkey = TRUE, + sp.layout = list(list("sp.points", + SpatialPoints(VALUE_Iberia_pr$xyCoords[ind,]), pch = 4, cex = 1.5, + first = FALSE, col = "black"))) + + } } \references{