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

Add arguments lab_dist_x and lab_dist_y

parent 9ce565fc
......@@ -116,6 +116,12 @@
#' TRUE by default.
#'@param labW Whether to label the longitude axis with a 'W' instead of minus
#' for negative values. Defaults to FALSE.
#'@param lab_dist_x A numeric of the distance of the longitude labels to the
#' box borders. The default value is NULL and is automatically adjusted by
#' the function.
#'@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 intylat Interval between latitude ticks on y-axis, in degrees.
#' Defaults to 20.
#'@param intxlon Interval between latitude ticks on x-axis, in degrees.
......@@ -227,6 +233,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,
intylat = 20, intxlon = 20,
axes_tick_scale = 1, axes_label_scale = 1,
drawleg = TRUE, subsampleg = NULL,
......@@ -536,6 +543,16 @@ PlotEquiMap <- function(var, lon, lat, varu = NULL, varv = NULL,
if (!is.logical(labW)) {
stop("Parameter 'labW' must be logical.")
}
if (!is.null(lab_dist_x)) {
if (!is.numeric(lab_dist_x)) {
stop("Parameter 'lab_dist_x' must be numeric.")
}
}
if (!is.null(lab_dist_y)) {
if (!is.numeric(lab_dist_y)) {
stop("Parameter 'lab_dist_y' must be numeric.")
}
}
if (!is.numeric(intylat)) {
stop("Parameter 'intylat' must be numeric.")
} else {
......@@ -734,10 +751,13 @@ PlotEquiMap <- function(var, lon, lat, varu = NULL, varv = NULL,
}
if (axelab) {
lab_distance_y <- ifelse(is.null(lab_dist_y), spaceticklab + 0.2, lab_dist_y)
lab_distance_x <- ifelse(is.null(lab_dist_x), spaceticklab + cex_axes_labels / 2 - 0.3, lab_dist_x)
axis(2, at = ypos, labels = ylabs, cex.axis = cex_axes_labels, tcl = cex_axes_ticks,
mgp = c(0, spaceticklab + 0.2, 0))
mgp = c(0, lab_distance_y, 0))
axis(1, at = xpos, labels = xlabs, cex.axis = cex_axes_labels, tcl = cex_axes_ticks,
mgp = c(0, spaceticklab + cex_axes_labels / 2 - 0.3, 0))
mgp = c(0, lab_distance_x, 0))
}
title(toptitle, cex.main = cex_title)
rect(par("usr")[1], par("usr")[3], par("usr")[2], par("usr")[4], col = colNA)
......
......@@ -44,6 +44,8 @@ PlotEquiMap(
arr_scale_shaft_angle = 1,
axelab = TRUE,
labW = FALSE,
lab_dist_x = NULL,
lab_dist_y = NULL,
intylat = 20,
intxlon = 20,
axes_tick_scale = 1,
......@@ -215,6 +217,14 @@ TRUE by default.}
\item{labW}{Whether to label the longitude axis with a 'W' instead of minus
for negative values. Defaults to FALSE.}
\item{lab_dist_x}{A numeric of the distance of the longitude labels to the
box borders. The default value is NULL and is automatically adjusted by
the function.}
\item{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.}
\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