diff --git a/R/PlotLayout.R b/R/PlotLayout.R index 742478e08db3ad08563ae00b6619379b9448bb9b..00ba6747e98d4213ecb0be30e4b6b6e69235fa2c 100644 --- a/R/PlotLayout.R +++ b/R/PlotLayout.R @@ -101,6 +101,8 @@ #' (specified in 'row_titles' and 'col_titles'). Takes 1 by default. #'@param subtitle_margin_scale Scale factor for the margins surrounding the #' subtitles. Takes 1 by default. +#'@param subplot_titles_scale Scale factor for the subplots top titles. Takes +#' 1 by default. #'@param units Title at the top of the colour bar, most commonly the units of #' the variable provided in parameter 'var'. #'@param brks,cols,bar_limits,triangle_ends Usually only providing 'brks' is @@ -216,6 +218,7 @@ PlotLayout <- function(fun, plot_dims, var, ..., special_args = NULL, title_scale = 1, title_margin_scale = 1, title_left_shift_scale = 1, subtitle_scale = 1, subtitle_margin_scale = 1, + subplot_titles_scale = 1, brks = NULL, cols = NULL, drawleg = 'S', titles = NULL, subsampleg = NULL, bar_limits = NULL, triangle_ends = NULL, col_inf = NULL, col_sup = NULL, @@ -392,6 +395,11 @@ PlotLayout <- function(fun, plot_dims, var, ..., special_args = NULL, stop("Parameter 'subtite_margin_scale' must be numeric.") } + # Check subplot_titles_scale + if (!is.numeric(subplot_titles_scale)) { + stop("Parameter 'subplot_titles_scale' must be numeric.") + } + # Check titles if (!all(sapply(titles, is.character))) { stop("Parameter 'titles' must be a vector of character strings.") @@ -661,11 +669,16 @@ PlotLayout <- function(fun, plot_dims, var, ..., special_args = NULL, fun_args <- c(list(y, toptitle = titles[plot_number]), list(...), special_args[[array_number]]) funct <- fun[[array_number]] - if (fun[[array_number]] %in% c('PlotEquiMap', 'PlotStereoMap', 'PlotSection')) { + if (fun[[array_number]] %in% c('PlotEquiMap', 'PlotStereoMap')) { fun_args <- c(fun_args, list(brks = colorbar$brks, cols = colorbar$cols, col_inf = colorbar$col_inf, col_sup = colorbar$col_sup, - drawleg = FALSE)) + drawleg = FALSE, + title_scale = subplot_titles_scale)) + } else if (fun[[array_number]] == c('PlotSection')) { + fun_args <- c(fun_args, list(brks = colorbar$brks, cols = colorbar$cols, + drawleg = FALSE)) + } do.call(fun[[array_number]], fun_args) plot_number <<- plot_number + 1 diff --git a/man/PlotLayout.Rd b/man/PlotLayout.Rd index f8e7bae376763de767cd967a4f3baee1d608ceef..2a053ad04b0291f71dcf5bee4e946ceb7a6d2034 100644 --- a/man/PlotLayout.Rd +++ b/man/PlotLayout.Rd @@ -21,6 +21,7 @@ PlotLayout( title_left_shift_scale = 1, subtitle_scale = 1, subtitle_margin_scale = 1, + subplot_titles_scale = 1, brks = NULL, cols = NULL, drawleg = "S", @@ -152,6 +153,9 @@ be disregarded if no 'row_titles' are provided.} \item{subtitle_margin_scale}{Scale factor for the margins surrounding the subtitles. Takes 1 by default.} +\item{subplot_titles_scale}{Scale factor for the subplots top titles. Takes +1 by default.} + \item{brks, cols, bar_limits, triangle_ends}{Usually only providing 'brks' is enough to generate the desired colour bar. These parameters allow to define n breaks that define n - 1 intervals to classify each of the values