knitr::opts_chunk$set(echo = FALSE) library(drake) library(dplyr) library(ggplot2) library(grid) theme_set(theme_bw()) library(scadsanalysis)
# # mcdb <- load_dataset("mcdb") # # set.seed(1977) # p <- filter(mcdb, site == 1944) # # p_samples <- sample_fs_wrapper(p, site_name = 1944, F, 200) # # p_di <- add_dis(p_samples) # # write.csv(p_di, "portal_di.csv") # write.csv(p_samples, "portal_samples.csv") portal_samples <- read.csv("portal_samples.csv") %>% select(-X) portal_di <- read.csv("portal_di.csv") %>% select(-X)
portal_samples <- left_join(portal_samples, portal_di) portal_samples <- portal_samples %>% mutate(`Simpson's evenness` = simpson) ga <- ggplot(filter(portal_samples, source == "sampled"), aes(rank, abund, group = sim, color = `Simpson's evenness`)) + geom_line(alpha = .1) + geom_line(data = filter(portal_samples, source == "observed"), size = 1.) + scale_color_viridis_c(option = "plasma", end = .8, direction = -1) + theme(legend.justification = c(0,1.65), legend.position = c(0.01,1)) + ggtitle("Observed SAD v. statistical baseline") + ylab("Abundance") + xlab("Rank") + theme(axis.text.x = element_blank(), axis.ticks.x = element_blank(), axis.ticks.y = element_blank(), axis.text.y = element_blank(), plot.title = element_text(size = 8), panel.grid = element_blank(), axis.title = element_text(size =7), plot.title.position = "plot", legend.text = element_blank(), legend.title = element_blank(), legend.direction = "horizontal", legend.key.height = unit(1, units = "mm"), legend.background = element_blank()) + geom_text(data = NULL, aes(x = 1.8, y = 210, label = "Evenness"), inherit.aes = F, color = "black", alpha = .01, size = 2.5, hjust = 0) + geom_text(data = NULL, aes(x = 1.8, y = 175, label = "low"), inherit.aes = F, color = "black", alpha = .01, size = 2.5, hjust = 0) + geom_text(data = NULL, aes(x = 9, y = 175, label = "high"), inherit.aes = F, color = "black", alpha = .01, size = 2.5, hjust = 0) ga ggsave("graphical_abstract.pdf", plot = ga, device = "pdf", width = 50, height = 50, units = "mm")
While the classic "hollow curve" form of the SAD emerges from randomly dividing individuals between species, observed SADs are consistently much more uneven than the majority of forms that emerge at random. These deviations between observations and the statistical baseline may reflect biological processes shaping the SAD, and provide new leverage for using the SAD to evaluate and refine ecological theory.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.