#' Providence ggplot theme
#'
#' [ggplot2] plot theme based on Providence style guide
#'
#' @param base_theme A base theme upon which additional theme-specific options are applied
#' @param background.fill color used as background fill. accepts any valid named color from 'providence_colors'. default is providence_colors["white"].
#' @param ... additional parameters passed through to ggplot2::theme.
#'
#' @references https://github.com/gadenbuie/ggpomological/blob/master/R/theme_pomological.R
#' @seealso [ggplot2::theme]
#'
#' @examples
#' \dontrun{
#' library(ggplot2)
#' data <- data.frame(x = 1:10, y = 1:10)
#' ggplot(data, aes(x, y)) + geom_point() + theme_test()
#' }
#'
#'
#' @export
theme_providence <- function(base_theme = ggplot2::theme_minimal(),
background.fill = "white",
...) {
base_theme +
ggplot2::theme(
title = ggplot2::element_text(hjust = 0.5, vjust = 0.5),
plot.background = ggplot2::element_rect(fill = ProvidenceThemes::providence_colors[background.fill]),
#legend.text = element_text(size=rel(0.5)),
...)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.