diff --git a/R/PlotEquiMap.R b/R/PlotEquiMap.R index 9c78873e98dbafa5f8c8943c695ad5613a57e62c..f6a85380bedaa0649ae56026c2721a6e308f4f2f 100644 --- a/R/PlotEquiMap.R +++ b/R/PlotEquiMap.R @@ -125,6 +125,7 @@ #'@param lab_dist_y A numeric of the distance of the latitude labels to the #' box borders. The default value is NULL and is automatically adjusted by #' the function. +#'@param degree_sym A logical indicating whether to include degree symbol (30° N) or not (30N; default). #'@param intylat Interval between latitude ticks on y-axis, in degrees. #' Defaults to 20. #'@param intxlon Interval between latitude ticks on x-axis, in degrees. @@ -237,7 +238,7 @@ PlotEquiMap <- function(var, lon, lat, varu = NULL, varv = NULL, arr_ref_len = 15, arr_units = "m/s", arr_scale_shaft = 1, arr_scale_shaft_angle = 1, axelab = TRUE, labW = FALSE, - lab_dist_x = NULL, lab_dist_y = NULL, + lab_dist_x = NULL, lab_dist_y = NULL, degree_sym = FALSE, intylat = 20, intxlon = 20, axes_tick_scale = 1, axes_label_scale = 1, drawleg = TRUE, subsampleg = NULL, @@ -700,6 +701,7 @@ PlotEquiMap <- function(var, lon, lat, varu = NULL, varv = NULL, margin_scale[1] <- margin_scale[1] - 1 } margins <- rep(0.4, 4) * margin_scale + margins[4] <- margins[4] + 1 cex_title <- 2 * title_scale cex_axes_labels <- 1.3 * axes_label_scale cex_axes_ticks <- -0.5 * axes_tick_scale @@ -708,20 +710,34 @@ PlotEquiMap <- function(var, lon, lat, varu = NULL, varv = NULL, ypos <- seq(latmin, latmax, intylat) xpos <- seq(lonmin, lonmax, intxlon) letters <- array('', length(ypos)) - letters[ypos < 0] <- 'S' - letters[ypos > 0] <- 'N' + if (degree_sym == FALSE) { + letters[ypos < 0] <- 'S' + letters[ypos > 0] <- 'N' + } else { + letters[ypos < 0] <- paste(intToUtf8(176), 'S') + letters[ypos > 0] <- paste(intToUtf8(176), 'N') + } ylabs <- paste(as.character(abs(ypos)), letters, sep = '') letters <- array('', length(xpos)) if (labW) { xpos2 <- xpos xpos2[xpos2 > 180] <- 360 - xpos2[xpos2 > 180] } - letters[xpos < 0] <- 'W' - letters[xpos > 0] <- 'E' + if (degree_sym == FALSE) { + letters[xpos < 0] <- 'W' + letters[xpos > 0] <- 'E' + } else { + letters[xpos < 0] <- paste(intToUtf8(176), 'W') + letters[xpos > 0] <- paste(intToUtf8(176), 'E') + } if (labW) { letters[xpos == 0] <- ' ' letters[xpos == 180] <- ' ' - letters[xpos > 180] <- 'W' + if (degree_sym == FALSE) { + letters[xpos > 180] <- 'W' + } else { + letters[xpos > 180] <- paste(intToUtf8(176), 'W') + } xlabs <- paste(as.character(abs(xpos2)), letters, sep = '') } else { xlabs <- paste(as.character(abs(xpos)), letters, sep = '') diff --git a/man/PlotEquiMap.Rd b/man/PlotEquiMap.Rd index c025afdab92225e2f5d4556ee559ed27944285ee..b574904cedbc13e914b8059e21ef3e8e5119b7a1 100644 --- a/man/PlotEquiMap.Rd +++ b/man/PlotEquiMap.Rd @@ -47,6 +47,7 @@ PlotEquiMap( labW = FALSE, lab_dist_x = NULL, lab_dist_y = NULL, + degree_sym = FALSE, intylat = 20, intxlon = 20, axes_tick_scale = 1, @@ -229,6 +230,8 @@ the function.} box borders. The default value is NULL and is automatically adjusted by the function.} +\item{degree_sym}{A logical indicating whether to include degree symbol (30° N) or not (30N; default).} + \item{intylat}{Interval between latitude ticks on y-axis, in degrees. Defaults to 20.}