# Load required libraries
pacman::p_load(pacman, tidyverse, tidyr, dplyr, readr, grid, gridExtra, ggplot2, RColorBrewer)
# Load CSV file
point_count_data <- read.csv("Ferraro_etal_pointcounts.csv")
# Convert site and measure to factors with meaningful labels
point_count_data$site <- factor(point_count_data$site,
levels = c("mc", "gc"),
labels = c("McClintock", "Gregory Canyon"))
point_count_data$measure <- factor(point_count_data$measure,
levels = c("total", "upc"),
labels = c("Real Birds", "Real + Phantom"))
# Viz 1: Bar Plot of Richness by Site, Week, and Measure
ggplot(point_count_data, aes(x = as.factor(week), y = richness, fill = measure)) +
geom_bar(stat = "identity", position = "dodge", width = 0.7) +
facet_wrap(~ site, ncol = 2) +
labs(title = "Bird Species Richness by Week and Trail",
subtitle = "Comparing Real Birds vs. Real + Phantom Chorus",
x = "Week", y = "Species Richness") +
theme_minimal() +
scale_fill_manual(values = c("#1b9e77", "#d95f02")) + # Vibrant colours
theme(legend.position = "top",
plot.title = element_text(hjust = 0.5, size = 16, face = "bold"),
plot.subtitle = element_text(hjust = 0.5, size = 12))

# Viz 2: Boxplot of Richness Distribution by Site and Measure
ggplot(point_count_data, aes(x = measure, y = richness, fill = measure)) +
geom_boxplot(alpha = 0.8) +
facet_wrap(~ site, ncol = 2) +
labs(title = "Distribution of Bird Species Richness",
subtitle = "Real vs. Enhanced Biodiversity Across Trails",
x = "Measure", y = "Species Richness") +
theme_bw() +
scale_fill_manual(values = c("#7570b3", "#e7298a")) + # Contrasting colours
theme(legend.position = "none",
plot.title = element_text(hjust = 0.5, size = 16, face = "bold"),
plot.subtitle = element_text(hjust = 0.5, size = 12))
