R/ggextras.R

Defines functions theme_empty space gg_color_hue

Documented in gg_color_hue space theme_empty

#' Blank theme for ggplot2
#' 
#' @importFrom ggplot2 theme_bw element_blank
#' @export


theme_empty <- function() {
  theme <- theme_bw()
  theme$line <- element_blank()
  theme$rect <- element_blank()
  theme$strip.text <- element_blank()
  theme$axis.text <- element_blank()
  theme$plot.title <- element_blank()
  theme$axis.title <- element_blank()
  theme$plot.margin <- structure(c(0, 0, -1, -1), unit = "lines", valid.unit = 3L, class = "unit")
  theme
}


#' Print numbers with digits groups separated by spaces
#' 
#' @param x numeric vector.
#' 
#' @export


space <- function(x, ...) {
  format(x, ..., big.mark = " ", scientific = FALSE, trim = TRUE)
}


#' Return ggplot2-like colors vector
#' 
#' @param n number of colors to return.
#' 
#' @importFrom grDevices hcl
#' @export

gg_color_hue <- function(n) {
  hues = seq(15, 375, length = n+1)
  hcl(h = hues, l = 65, c = 100)[1:n]
}
twolodzko/twextras documentation built on May 3, 2019, 1:52 p.m.