#load packages library("tidyverse") library("DBI")# also needs RMySQL installed theme_set(theme_bw())
source("start_here.R")
hogsete_plot <- function(target, comm = cover.thin, trace = 0){ treat_colour <- c("black", "grey50", "red", "blue", "purple") comm <- cover.thin %>% filter(destSiteID == target) %>% spread(key = species, value = cover, fill = 0) ord <- vegan::metaMDS(select(comm, -(siteID:destSiteID)), trace = trace) ford <- ggvegan:::fortify.cca(ord, display = "sites") dat <- ford %>% bind_cols(select(comm, siteID:destSiteID)) %>% arrange(year) ggplot(dat, aes(x = NMDS1, y = NMDS2, group = turfID, colour = TTtreat)) + geom_path() + geom_point(aes(size = if_else(year == 2009, 1, NA_real_)), show.legend = FALSE) + scale_colour_manual(values = treat_colour, limits = paste0("TT", c("C", 1:4))) + coord_equal() + ggtitle(target) } cover.thin %>% distinct(destSiteID) %>% pull(destSiteID) %>% map(hogsete_plot) %>% walk(print)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.