# Create comprehensive visualization of all diversity indices
diversity_all_ordered <- diversity_all %>%
arrange(desc(Shannon_Index))
# Create multi-panel plot
p1 <- ggplot(diversity_all_ordered, aes(x = reorder(Site, Shannon_Index), y = Shannon_Index)) +
geom_bar(stat = "identity", fill = "steelblue", alpha = 0.7) +
coord_flip() +
labs(title = "Shannon Diversity Index",
x = "Site", y = "Shannon Index (H')") +
theme_minimal(base_size = 14) +
theme(plot.title = element_text(face = "bold", size = 18),
axis.title = element_text(size = 14, face = "bold"),
axis.text = element_text(size = 12),
axis.text.y = element_text(size = 12))
p2 <- ggplot(diversity_all_ordered, aes(x = reorder(Site, Shannon_Index), y = Simpson_Index)) +
geom_bar(stat = "identity", fill = "darkgreen", alpha = 0.7) +
coord_flip() +
labs(title = "Simpson's Diversity Index",
x = "Site", y = "Simpson Index (1-D)") +
theme_minimal(base_size = 14) +
theme(plot.title = element_text(face = "bold", size = 18),
axis.title = element_text(size = 14, face = "bold"),
axis.text = element_text(size = 12),
axis.text.y = element_text(size = 12))
p3 <- ggplot(diversity_all_ordered, aes(x = reorder(Site, Shannon_Index), y = Species_Richness)) +
geom_bar(stat = "identity", fill = "darkorange", alpha = 0.7) +
coord_flip() +
labs(title = "Species Richness",
x = "Site", y = "Number of Species") +
theme_minimal(base_size = 14) +
theme(plot.title = element_text(face = "bold", size = 18),
axis.title = element_text(size = 14, face = "bold"),
axis.text = element_text(size = 12),
axis.text.y = element_text(size = 12))
# Combine plots using patchwork
p1 / p2 / p3 +
plot_annotation(title = "Diversity Indices Across All California Sites",
theme = theme(plot.title = element_text(face = "bold", size = 22)))