Commit cc3a4aa1 authored by aho's avatar aho
Browse files

Merge branch 'develop-PlotEquiMap-degrees' into 'master'

Develop PlotEquiMap with degree symbol in lons and lats labels

See merge request !71
parents dddec28b 87f01cf9
Pipeline #5800 passed with stage
in 3 minutes and 56 seconds
......@@ -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 = '')
......
......@@ -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.}
......
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