R/custom_theme.R

Defines functions custome_theme

Documented in custome_theme

#' Custom theme for maps and bar charts
#'
#' @param plot_type The type of plot - "map" or "bar"
#'
#' @return Custom theme that complements the aesthetics of the Shiny App
#'
#' @import ggplot2
#'
#' @export

custome_theme <- function(plot_type) {
  if(plot_type == "map"){
    ggplot2::theme_void() +
    ggplot2::theme(panel.background = element_rect(fill = "#1f1f1f"),
            plot.background = element_rect(fill = "#1f1f1f"),
            axis.line = element_blank(),
            plot.title = element_text(size = 15, face = "bold", colour = "white"),
            legend.position = "none")
  } else if(plot_type == "bar"){
    ggplot2::theme_linedraw() +
      ggplot2::theme(
        panel.background = element_rect(fill = "#1f1f1f"),
        plot.background = element_rect(fill = "#1f1f1f"),
        panel.border = element_blank(),
        axis.title = element_blank(),
        legend.position = "none",
        panel.grid = element_blank(),
        axis.text = element_text(colour = "white",
                                 size = 5)
      )
  }
}
etc5523-2020/r-package-assessment-BrendiA documentation built on Jan. 1, 2021, 1:10 a.m.