diff --git a/.Rbuildignore b/.Rbuildignore index 0abaa24..c977ed9 100644 --- a/.Rbuildignore +++ b/.Rbuildignore @@ -11,3 +11,4 @@ ^\.github$ ^CODE_OF_CONDUCT\.md$ ^bib$ +^shiny_app_dev$ diff --git a/.gitignore b/.gitignore index f074431..a010a1e 100644 --- a/.gitignore +++ b/.gitignore @@ -6,3 +6,4 @@ inst/doc doc Meta docs +shiny_app_dev/ diff --git a/NAMESPACE b/NAMESPACE index 566557c..3df74d6 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -4,6 +4,8 @@ export("%>%") export(.nafo_asp) export(.nafo_height) export(.nafo_lwd) +export(.nafo_pts) +export(.nafo_stroke) export(.nafo_width) export(draft) export(nafo_summary_table) diff --git a/R/figures.R b/R/figures.R index 0f29c10..c9fca01 100644 --- a/R/figures.R +++ b/R/figures.R @@ -30,7 +30,11 @@ #' d <- data.frame(SSB = rlnorm(40), Recruitment = rlnorm(40), #' Species = c(rep("Cod", 20), rep("Plaice", 20))) #' ggplot(d) + -#' geom_point(aes(x = SSB, y = Recruitment, shape = Species)) + +#' geom_point(aes(x = SSB, y = Recruitment, shape = Species), +#' fill = "white", color = "black", shape = 21, +#' size = .nafo_pts, stroke = .nafo_stroke) + +#' geom_hline(aes(yintercept = mean(Recruitment)), +#' linetype = 2, size = .nafo_lwd) + #' theme_nafo() #' @@ -40,11 +44,14 @@ theme_nafo <- function(base_size = 9, base_family = "Cambria"){ linetype = "solid", fill = NA), line = element_line(colour = "black", size = 0.5 / ggplot2::.pt, linetype = "solid", lineend = "butt"), + axis.ticks = element_line(colour = "black"), axis.ticks.length = unit(-0.15, "cm"), axis.text.x = element_text(margin = unit(c(0.25, 0.1, 0.1, 0.1), "cm")), axis.text.y = element_text(margin = unit(c(0.1, 0.25, 0.1, 0.1), "cm"), hjust = 1), + axis.line = element_line(colour = "black"), panel.grid.minor = element_blank(), panel.grid.major = element_blank(), + panel.background = element_rect(colour = "black"), plot.background = element_blank(), strip.background = element_blank(), legend.key = element_blank(), @@ -64,7 +71,9 @@ theme_nafo <- function(base_size = 9, base_family = "Cambria"){ #' Helper values for consistent plot settings #' #' @description +#' - `.nafo_pts`: this value is to be used in geom_point to define point size (it is 3 pt converted to mm) #' - `.nafo_lwd`: this value is to be used in geom_line to define line width (it is 0.75 pt converted to mm) +#' - `.nafo_stroke`: this value is to be used in geom_point to define stroke width (it is 0.75 pt converted to 1/96 inches) #' - `.nafo_height`: this value is to be used to define plot height in inches (it is 6.4 cm converted to inches) #' - `.nafo_width`: this value is to be used to define plot width in inches (it is 11.5 cm converted to inches) #' - `.nafo_asp`: this value is to be used to define the aspect ratio of a plot @@ -72,10 +81,18 @@ theme_nafo <- function(base_size = 9, base_family = "Cambria"){ #' @name nafo-vals NULL +#' @export +#' @rdname nafo-vals +.nafo_pts <- 3 / ggplot2::.pt + #' @export #' @rdname nafo-vals .nafo_lwd <- 0.75 / ggplot2::.pt +#' @export +#' @rdname nafo-vals +.nafo_stroke <- .nafo_lwd * ggplot2::.stroke / 2 + #' @export #' @rdname nafo-vals .nafo_height <- 6.4 / 2.54 diff --git a/man/nafo-vals.Rd b/man/nafo-vals.Rd index 159075a..4adf0aa 100644 --- a/man/nafo-vals.Rd +++ b/man/nafo-vals.Rd @@ -3,7 +3,9 @@ \docType{data} \name{nafo-vals} \alias{nafo-vals} +\alias{.nafo_pts} \alias{.nafo_lwd} +\alias{.nafo_stroke} \alias{.nafo_height} \alias{.nafo_width} \alias{.nafo_asp} @@ -15,11 +17,19 @@ An object of class \code{numeric} of length 1. An object of class \code{numeric} of length 1. +An object of class \code{numeric} of length 1. + +An object of class \code{numeric} of length 1. + An object of class \code{numeric} of length 1. } \usage{ +.nafo_pts + .nafo_lwd +.nafo_stroke + .nafo_height .nafo_width @@ -28,7 +38,9 @@ An object of class \code{numeric} of length 1. } \description{ \itemize{ +\item \code{.nafo_pts}: this value is to be used in geom_point to define point size (it is 3 pt converted to mm) \item \code{.nafo_lwd}: this value is to be used in geom_line to define line width (it is 0.75 pt converted to mm) +\item \code{.nafo_stroke}: this value is to be used in geom_point to define stroke width (it is 0.75 pt converted to 1/96 inches) \item \code{.nafo_height}: this value is to be used to define plot height in inches (it is 6.4 cm converted to inches) \item \code{.nafo_width}: this value is to be used to define plot width in inches (it is 11.5 cm converted to inches) \item \code{.nafo_asp}: this value is to be used to define the aspect ratio of a plot diff --git a/man/theme_NAFO.Rd b/man/theme_NAFO.Rd index 7e6ebd7..dc17c58 100644 --- a/man/theme_NAFO.Rd +++ b/man/theme_NAFO.Rd @@ -30,7 +30,11 @@ set.seed(123) d <- data.frame(SSB = rlnorm(40), Recruitment = rlnorm(40), Species = c(rep("Cod", 20), rep("Plaice", 20))) ggplot(d) + -geom_point(aes(x = SSB, y = Recruitment, shape = Species)) + +geom_point(aes(x = SSB, y = Recruitment, shape = Species), + fill = "white", color = "black", shape = 21, + size = .nafo_pts, stroke = .nafo_stroke) + +geom_hline(aes(yintercept = mean(Recruitment)), + linetype = 2, size = .nafo_lwd) + theme_nafo() }