── Technique 2: Data Visualisation ──────────────────────────────────────────
#| label: visualisation #| fig-width: 11 #| fig-height: 10
library(tidyverse) library(patchwork) library(scales)
── Plot 1: National Registration Trend (Line + Ribbon) ──────────────────────
p1 <- exam_data_clean %>% group_by(Year) %>% summarise(Total = sum(Candidates, na.rm = TRUE), .groups = “drop”) %>% ggplot(aes(x = Year, y = Total)) + geom_area(fill = “#1d6fa4”, alpha = 0.15) + geom_line(color = “#1d6fa4”, linewidth = 1.3) + geom_point(color = “#1d6fa4”, size = 3, fill = “white”, shape = 21, stroke = 2) + scale_y_continuous(labels = label_comma()) + scale_x_continuous(breaks = 2016:2025) + labs( title = “National WAEC Registration Trend (2016–2025)”, subtitle = “Total candidates registered per year across all states”, x = “Exam Year”, y = “Total Candidates” ) + theme_minimal(base_size = 13) + theme( plot.title = element_text(face = “bold”, size = 14), plot.subtitle = element_text(colour = “grey50”, size = 11), panel.grid.minor = element_blank(), axis.text.x = element_text(angle = 45, hjust = 1) )
── Plot 2: Total Candidates by Region (Horizontal Bar) ──────────────────────
region_palette <- c( “South West” = “#1d6fa4”, “South South” = “#2196a0”, “South East” = “#26a084”, “North West” = “#e07b2e”, “North East” = “#d64045”, “North Central” = “#c97bbf” )
p2 <- exam_data_clean %>% group_by(Region) %>% summarise(Total = sum(Candidates, na.rm = TRUE), .groups = “drop”) %>% mutate(Region = fct_reorder(Region, Total)) %>% ggplot(aes(x = Total, y = Region, fill = Region)) + geom_col(width = 0.65, show.legend = FALSE) + geom_text( aes(label = label_comma()(Total)), hjust = -0.1, size = 3.5, colour = “grey30” ) + scale_fill_manual(values = region_palette) + scale_x_continuous( labels = label_comma(), expand = expansion(mult = c(0, 0.18)) # room for labels ) + labs( title = “Total Candidates by Region (2016–2025)”, subtitle = “Southern regions account for the majority of registrations”, x = “Total Candidates”, y = NULL ) + theme_minimal(base_size = 13) + theme( plot.title = element_text(face = “bold”, size = 14), plot.subtitle = element_text(colour = “grey50”, size = 11), panel.grid.major.y = element_blank(), panel.grid.minor = element_blank() )
── Plot 3 (Bonus): Annual Trend Faceted by Region ───────────────────────────
p3 <- exam_data_clean %>% group_by(Year, Region) %>% summarise(Total = sum(Candidates, na.rm = TRUE), .groups = “drop”) %>% mutate(Region = factor(Region)) %>% ggplot(aes(x = Year, y = Total, colour = Region, group = Region)) + geom_line(linewidth = 1) + geom_point(size = 1.8) + scale_colour_manual(values = region_palette) + scale_y_continuous(labels = label_comma()) + scale_x_continuous(breaks = c(2016, 2019, 2022, 2025)) + facet_wrap(~Region, scales = “free_y”, ncol = 3) + labs( title = “Registration Trend by Region (2016–2025)”, subtitle = “Each panel uses its own y-axis scale to reveal within-region growth”, x = “Year”, y = “Total Candidates” ) + theme_minimal(base_size = 12) + theme( plot.title = element_text(face = “bold”, size = 14), plot.subtitle = element_text(colour = “grey50”, size = 11), legend.position = “none”, panel.grid.minor = element_blank(), strip.text = element_text(face = “bold”) )