Appendix B — Theming and Functions

The following ggplot2 theme is used to stylise plots.

library(ggplot2)

custom_ggplot_theme <- theme_classic(base_size = 11, 
                                     base_family = "Source Sans Pro") +
  theme(
      text = element_text(color = "#333333"),
      plot.background = element_blank(),
      panel.background = element_blank(),
      axis.text = element_text(color = "#333333"),
      axis.title = element_text(color = "#333333", face = "bold"),
      legend.text = element_text(color = "#333333"),
      legend.title = element_text(color = "#333333", face = "bold",),
      plot.title = element_text(size = 14, face = "bold", color = "#333333"),
      plot.subtitle = element_text(size = 12, face = "italic",
                                   color = "#333333"),
      strip.text = element_text(face = "bold",color = "#333333"),
      legend.position="bottom")

theme_set(custom_ggplot_theme)
extract_comparison_results <- function(results) {
  extracted_results <- data.frame(
    Estimate = results$estimate,
    SE = results$std.error,
    P.Value = results$p.value,
    Lower.CI = results$conf.low,
    Upper.CI = results$conf.high
  )
  
  return(extracted_results)
}