#' Apply a light theme on a ggplot with the Sarid theme.
#' Based on the theme_bw() layout, works similarly to theme().
#'
#'
#' @description The standard Sarid theme includes a re-coloring of certain plot elements
#' with the Sarid color palette.
#' The most notable difference is the strip background color and text color and
#' the font sizes for titles and axis.
#'
#' @param ... Additional arguments passed to the theme function.
#'
#' @return An updated ggplot object rebranded to the Sarid look and feel.
#'
#' @examples
#' base_plot <- ggplot(mtcars, aes(x = disp, y = mpg, color = factor(cyl))) + geom_point()
#' base_plot + theme_sarid()
#' base_plot + theme_sarid() + facet_wrap(~vs)
#'
#' @export
theme_sarid <- function(...){
# create the updated Sarid theme
return_theme <- ggplot2::theme_bw() +
ggplot2::theme(plot.title = ggplot2::element_text(color = "#0066ff", size = 15),
plot.subtitle = ggplot2::element_text(color = "#3398ff", size = 13),
plot.caption = ggplot2::element_text(color = "#3398ff"),
axis.title = ggplot2::element_text(color = "#000000", size = 13),
axis.text = ggplot2::element_text(color = "#000000", size = 12),
strip.background = ggplot2::element_rect(fill = "#ffeca3"),
strip.text = ggplot2::element_text(color = "#6D6E71", face = "bold"),
panel.background = element_blank(),
legend.background = element_blank())
ggplot2::theme(...)
return_theme
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.