Commit 9ce565fc authored by aho's avatar aho
Browse files

Add parameter 'lake_color' to specify lake color when filled.continents = T

parent f8b987fb
Pipeline #5743 passed with stage
in 9 minutes and 27 seconds
......@@ -64,6 +64,9 @@
#' Takes the value gray(0.5) by default.
#'@param coast_width Line width of the coast line of the drawn projected
#' continents. Takes the value 1 by default.
#'@param lake_color Colour of the lake or other water body inside continents.
#' It is only functional when 'filled.continents = TRUE'. The default value is
#' 'white'.
#'@param contours Array of same dimensions as 'var' to be added to the plot
#' and displayed with contours. Parameter 'brks2' is required to define the
#' magnitude breaks for each contour curve. Disregarded if 'square = FALSE'.
......@@ -215,7 +218,7 @@ PlotEquiMap <- function(var, lon, lat, varu = NULL, varv = NULL,
triangle_ends = NULL, col_inf = NULL, col_sup = NULL,
colNA = NULL, color_fun = clim.palette(),
square = TRUE, filled.continents = NULL,
coast_color = NULL, coast_width = 1,
coast_color = NULL, coast_width = 1, lake_color = NULL,
contours = NULL, brks2 = NULL, contour_lwd = 0.5,
contour_color = 'black', contour_lty = 1,
contour_draw_label = TRUE, contour_label_scale = 1,
......@@ -426,6 +429,17 @@ PlotEquiMap <- function(var, lon, lat, varu = NULL, varv = NULL,
stop("Parameter 'coast_width' must be numeric.")
}
# Check lake_color
if (is.null(lake_color)) {
if (filled.continents) {
lake_color <- 'white'
}
} else {
if (!.IsColor(coast_color)) {
stop("Parameter 'coast_color' must be a valid colour identifier.")
}
}
# Check contours
if (!is.null(contours)) {
if (dim(contours)[1] != dims[1] || dim(contours)[2] != dims[2]) {
......@@ -791,7 +805,7 @@ PlotEquiMap <- function(var, lon, lat, varu = NULL, varv = NULL,
LAT0 = mean(ylat), LATS = ylat, LONS = xlon)
lakes <- which(coastmap$STROKES$col == "blue")
coastmap$STROKES$col[which(coastmap$STROKES$col != "blue")] <- continent_color
coastmap$STROKES$col[lakes] <- "white"
coastmap$STROKES$col[lakes] <- lake_color #"white"
par(new = TRUE)
GEOmap::plotGEOmap(coastmap, PROJ = proj, border = coast_color,
add = TRUE, lwd = coast_width)
......
......@@ -25,6 +25,7 @@ PlotEquiMap(
filled.continents = NULL,
coast_color = NULL,
coast_width = 1,
lake_color = NULL,
contours = NULL,
brks2 = NULL,
contour_lwd = 0.5,
......@@ -143,6 +144,10 @@ Takes the value gray(0.5) by default.}
\item{coast_width}{Line width of the coast line of the drawn projected
continents. Takes the value 1 by default.}
\item{lake_color}{Colour of the lake or other water body inside continents.
It is only functional when 'filled.continents = TRUE'. The default value is
'white'.}
\item{contours}{Array of same dimensions as 'var' to be added to the plot
and displayed with contours. Parameter 'brks2' is required to define the
magnitude breaks for each contour curve. Disregarded if 'square = FALSE'.}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment