R/theme_prevR.r

Defines functions theme_prevR_light theme_prevR

Documented in theme_prevR theme_prevR_light

#' prevR themes for ggplot2
#'
#' Two custom themes for ggplot2 graphs, hiding axis.
#'
#' @param base_size base font size
#' @importFrom ggplot2 '%+replace%' theme theme_grey element_blank unit
#'
#' @export

theme_prevR <- function(base_size = 12) {
  ggplot2::"%+replace%"(
    ggplot2::theme_grey(base_size),
    ggplot2::theme(
      axis.title        = ggplot2::element_blank(),
      axis.text         = ggplot2::element_blank(),
      axis.ticks.length = ggplot2::unit(0, "cm"),
      plot.margin       = ggplot2::unit(c(0, 0, 0, 0), "lines"),
      complete          = TRUE
    )
  )
}

#' @export
#' @rdname theme_prevR
theme_prevR_light <- function(base_size = 12) {
  ggplot2::"%+replace%"(
    ggplot2::theme_grey(base_size),
    ggplot2::theme(
      axis.title        = ggplot2::element_blank(),
      axis.text         = ggplot2::element_blank(),
      panel.background  = ggplot2::element_blank(),
      panel.grid        = ggplot2::element_blank(),
      axis.ticks.length = ggplot2::unit(0, "cm"),
      plot.margin       = ggplot2::unit(c(0, 0, 0, 0), "lines"),
      complete          = TRUE
    )
  )
}

Try the prevR package in your browser

Any scripts or data that you put into this service are public.

prevR documentation built on May 31, 2023, 7:32 p.m.