#' GGPlot2 theme
#'
#' Clean look for a GGPlot2 plot
#'
#' @param ratio Default is the golden ratio. Could also be `square` (1.2), `long` (2.2) or `equal` (1).
#' @param landscape Plot in landscape-mode or not?
#' @return A ggtheme
#' @export
RHWtheme <- function(ratio = 'gold', landscape = T){
ratios = c('gold' = ((1+sqrt(5)) / 2), 'square' = 1.2, 'long' = 2.2, 'equal' = 1)
if(! ratio %in% names(ratios)){
stop("Choose ratio from ", paste(collapse = '/', names(ratios)), '.')
}
ratio <- ratios[which(names(ratios) == ratio)]
if(landscape){
ratio <- 1/ratio
}
THEME <- ggplot2::theme(panel.background = ggplot2::element_rect(fill = NA,
color = 'black', size = .5),
legend.key = ggplot2::element_rect(fill = NA),
panel.grid = ggplot2::element_blank(),
axis.line = ggplot2::element_blank(),
axis.ticks = ggplot2::element_line(colour = 'black', size = .5,
lineend = 'square'),
text = ggplot2::element_text(color = 'black'),
aspect.ratio = ratio,
axis.text = ggplot2::element_text(color = 'black'),
strip.background = ggplot2::element_blank(),
strip.text = ggplot2::element_text( color = 'black'))
# COORD <- ggplot2::scale_y_continuous()
return(list(THEME))#, COORD))
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.