R/utils_helpers.R

Defines functions theme_saint

theme_saint <- function(color.background = "white",
                        color.text = "#22211d"){
  theme_bw(base_size=15) +
    
    # Format background colors
    theme(panel.background = element_rect(fill=color.background, color=color.background)) +
    theme(plot.background  = element_rect(fill=color.background, color=color.background)) +
    theme(panel.border     = element_rect(color=color.background)) +
    theme(strip.background = element_rect(fill=color.background, color=color.background)) +
    
    # Format the grid
    theme(panel.grid.major = element_blank()) +
    theme(panel.grid.minor = element_blank()) +
    theme(axis.ticks       = element_blank()) +
    
    # Format the legend
    theme(legend.position = "bottom") +
    theme(legend.text = element_text(size = 8, color = color.text)) +
    theme(legend.title = element_text(size = 10, face = "bold", color = color.text)) +
    
    # Format title and axis labels
    theme(plot.title       = element_text(color=color.text, size=20, face = "bold")) +
    theme(axis.text.x      = element_text(size=12, color="black")) +
    theme(axis.text.y      = element_text(size=12, color="black")) +
    theme(axis.title.x     = element_text(size=14, color="black", face = "bold")) +
    theme(axis.title.y     = element_text(size=14, color="black", vjust=1.25)) +
    theme(axis.text.x      = element_text(size=10, hjust = 0, color = color.text)) +
    theme(axis.text.y      = element_text(size=10, color = color.text)) +
    theme(strip.text       = element_text(face = "bold")) + 
    
    # Plot margins
    theme(plot.margin = unit(c(0.35, 0.2, 0.3, 0.35), "cm"))
}
databrew/saint documentation built on May 13, 2021, 10:56 a.m.