From 74449e2f1a1bb94ec851a3913f98badceda80167 Mon Sep 17 00:00:00 2001 From: ARIADNA BATALLA FERRES Date: Wed, 10 Sep 2025 16:12:14 +0200 Subject: [PATCH] Update format of esviz documentation examples (pt1) --- R/VizPDFsOLE.R | 26 +++++++++++++------------- R/VizRobinson.R | 3 +-- R/VizSection.R | 3 ++- R/VizStereoMap.R | 1 + R/VizTriangles4Categories.R | 1 + R/VizVsLTime.R | 2 +- 6 files changed, 19 insertions(+), 17 deletions(-) diff --git a/R/VizPDFsOLE.R b/R/VizPDFsOLE.R index 280f3b0..c26571d 100644 --- a/R/VizPDFsOLE.R +++ b/R/VizPDFsOLE.R @@ -213,24 +213,24 @@ VizPDFsOLE <- function(pdf_1, pdf_2, nsigma = 3, legendPos = 'bottom', limits = c(name1, name2, nameBest), labels = c(label1, label2, labelBest)) - g <- g + theme(plot.title=element_text(size=rel(1.1), colour="black", - face= "bold"), - axis.text.x = element_text(size=rel(1.2)), - axis.text.y = element_text(size=rel(1.2)), + g <- g + theme(plot.title = element_text(size = rel(1.1), colour = "black", + face = "bold"), + axis.text.x = element_text(size = rel(1.2)), + axis.text.y = element_text(size = rel(1.2)), axis.title.x = element_blank(), legend.title = element_blank(), legend.position = legendPos, - legend.text = element_text(face = "bold", size=rel(legendSize))) + legend.text = element_text(face = "bold", size = rel(legendSize))) g <- g + ggtitle(graphicTitle) - g <- g + labs(y="probability", size=rel(1.9)) - g <- g + stat_function(fun = dnorm_limit, args = list(mean=mean1, sd=sigma1), - fill = cols[name1], alpha=0.2, geom="area") - g <- g + stat_function(fun = dnorm_limit, args = list(mean=mean2, sd=sigma2), - fill = cols[name2], alpha=0.2, geom="area") - g <- g + stat_function(fun = dnorm_limit, args = list(mean=meanBest, - sd=sigmaBest), - fill = cols[nameBest], alpha=0.2, geom="area") + g <- g + labs(y = "probability", size = rel(1.9)) + g <- g + stat_function(fun = dnorm_limit, args = list(mean = mean1, sd = sigma1), + fill = cols[name1], alpha = 0.2, geom = "area") + g <- g + stat_function(fun = dnorm_limit, args = list(mean = mean2, sd=sigma2), + fill = cols[name2], alpha = 0.2, geom = "area") + g <- g + stat_function(fun = dnorm_limit, args = list(mean = meanBest, + sd = sigmaBest), + fill = cols[nameBest], alpha = 0.2, geom = "area") #----------------------------------------------------------------------------- diff --git a/R/VizRobinson.R b/R/VizRobinson.R index 9134151..a6b94eb 100644 --- a/R/VizRobinson.R +++ b/R/VizRobinson.R @@ -108,7 +108,6 @@ #'dots <- data #'dots[which(dots < 4 & dots > -4)] <- 0 #'dots[which(dots != 0)] <- 1 -#' \dontrun{ #'VizRobinson(data, lon = 0:359, lat = -90:90, dots = dots, #' brks = seq(-10, 10, length.out = 11), #' toptitle = 'synthetic example', vertical = FALSE, @@ -119,7 +118,7 @@ #' color_fun = ClimPalette("purpleorange"), colNA = 'green', #' toptitle = 'synthetic example', caption = 'Mollweide Projection', #' width = 8, height = 6) -#' } +# #'@import sf ggplot2 rnaturalearth cowplot utils #'@importFrom dplyr mutate group_by summarise #'@importFrom ClimProjDiags Subset diff --git a/R/VizSection.R b/R/VizSection.R index 8742ef6..a718c4d 100644 --- a/R/VizSection.R +++ b/R/VizSection.R @@ -42,8 +42,9 @@ #'# Synthetic data #'data <- array(rep(seq(25, 10, length.out = 7), each = 21) - rnorm(147), #' dim = c(lat = 21, depth = 7)) -#'esviz:::VizSection(data, horiz = 0:20, depth = seq(0, 300, length.out = 7), +#'VizSection(data, horiz = 0:20, depth = seq(0, 300, length.out = 7), #' toptitle = 'Temperature cross-section', units = "degC") +#' #'@importFrom grDevices dev.cur dev.new dev.off rainbow VizSection <- function(data, horiz, depth, toptitle = '', title_scale = 1, sizetit = NULL, units = '', brks = NULL, cols = NULL, diff --git a/R/VizStereoMap.R b/R/VizStereoMap.R index 5c73210..847ddc2 100644 --- a/R/VizStereoMap.R +++ b/R/VizStereoMap.R @@ -174,6 +174,7 @@ #'y <- seq(from = -90, to = 90, length.out = 50) #'VizStereoMap(data = data, lon = x, lat = y, latlims = c(60, 90), brks = 50, #' toptitle = "This is the title") +#' #'@import mapproj utils #'@importFrom grDevices dev.cur dev.new dev.off gray #'@importFrom stats median diff --git a/R/VizTriangles4Categories.R b/R/VizTriangles4Categories.R index ca48f5f..629aaac 100644 --- a/R/VizTriangles4Categories.R +++ b/R/VizTriangles4Categories.R @@ -73,6 +73,7 @@ #' lab_legend = c('NAO+', 'BL','AR','NAO-'), #' xtitle = "Target month", ytitle = "Lead time", #' xlabels = c("Jan", "Feb", "Mar", "Apr")) +#' #'@importFrom grDevices dev.new dev.off dev.cur #'@importFrom graphics plot points polygon text title axis #'@importFrom RColorBrewer brewer.pal diff --git a/R/VizVsLTime.R b/R/VizVsLTime.R index 9fac301..ae0a8fc 100644 --- a/R/VizVsLTime.R +++ b/R/VizVsLTime.R @@ -80,7 +80,7 @@ #'input_cor[, 2, ] <- corr_ano$corr[, 1, 1, ] #'input_cor[, 3, ] <- corr_ano$conf.upper[, 1, 1, ] #'input_cor[, 4, ] <- corr_ano$p.val[, 1, 1, ] -#'esviz:::VizVsLTime(input_cor, toptitle = "Correlation", +#'VizVsLTime(input_cor, toptitle = "Correlation", #' monini = 11, limits = c(-1, 2), listexp = 'SEAS5', #' listobs = 'ERA5', biglab = FALSE, hlines = c(-1, 0, 1)) #' -- GitLab