R/theme_map.R

Defines functions theme_map

Documented in theme_map

#' Custom theme function
#' 
#' @param bg color of the panel backgound
#' @param grid color of the grid
#' @param axis boolean, whether or not to include the axis
#' @param legend.position legend position, option include: 'top', 'bottom', 'left', 'right', and 'none'
#' @export
#' 

theme_map <- function(bg = "#E0F0FF", grid = "#00000010", axis = T, legend.position = "right"){
if(axis){
  a <- element_text()
  at <- element_line()
}else{
  a <- element_blank()
  at <- element_blank()
}

theme(
  panel.border = element_rect(fill = NA, colour = "black"),
  panel.background = element_rect(fill = bg),
  panel.grid = element_line(colour = grid),
  axis.text = a,
  axis.ticks = at,
  legend.position = legend.position
)
} 
jpablo91/Pabloverse documentation built on April 11, 2024, 2:54 p.m.