knitr::opts_chunk$set(echo = TRUE)
Requirements :
Load the following variables from analysis_nonpublic.R
:
- load package (as usual)
- pathtodata
- master_alpha
- trlevels
- plotNAset
- LUI
- distLUI
- EFmastser
- gdm_EFdistance_LUI_input
from results_nonpublic.R
- nicenames
require(cowplot) # masterdiversity <- data.table::data.table(masterdiversity) masterbeta <- data.table::data.table(masterbeta) LUI <- data.table::data.table(LUI) # only selected plot set masterdiversity <- masterdiversity[Var1 %in% plotNAset & Var2 %in% plotNAset, ] masterbeta <- masterbeta[Var1 %in% plotNAset & Var2 %in% plotNAset,]
Create dataset with all predictors
full_master <- merge(EFmaster, masterbeta, by = c("Var1", "Var2")) any(is.na(full_master)) full_master <- merge(full_master, distLUI, by = c("Var1", "Var2"), all.x = T) any(is.na(full_master)) temp <- data.table::copy(LUI) setnames(temp, old = "Plotn", new = "Var1") full_master <- merge(full_master, temp, by = "Var1") setnames(temp, old = "Var1", new = "Var2") full_master <- merge(full_master, temp, by = "Var2") rm(temp) # add mean LUI full_master[, meanLUI := rowMeans(full_master[, .(LUI.x, LUI.y)])] ggfull_master <- melt(full_master, id.vars = c("Var1", "Var2")) # get colours for trophic levels #TODO put right color for each level # longpallette <- unique(nicenames$color) #TODO nicenames are shown in a strange way... longpallette <- c("#999999", "#E69F00", "#56B4E9", "#009E73", "#F0E442", "#0072B2", "#D55E00", "#CC79A7","#000000", "#E69F00", "#56B4E9", "#009E73", "#F0E442", "#0072B2", "#D55E00", "#CC79A7")
ggplot(full_master, aes(x = LUI.x, y = LUI.y, colour = distLUI)) + geom_point() + scale_color_gradient(low="blue", high="red") + labs(subtitle = c("distLUI is ambiguous, per distLUI value, two possible LUI values.")) # EFdistance and LUI ggplot(full_master, aes(x = LUI.x, y = LUI.y, colour = EFdistance)) + geom_point() + scale_color_gradient(low="blue", high="red") a <- ggplot(full_master, aes(x = distLUI, y = EFdistance, colour = LUI.y)) + geom_point() + scale_color_gradient(low="blue", high="red") b <- ggplot(full_master, aes(x = distLUI, y = EFdistance, colour = LUI.x)) + geom_point() + scale_color_gradient(low="blue", high="red") plot_grid(a, b, nrow = 1) # delta LUI vs. mean LUI ggplot(full_master, aes(x = meanLUI, y = distLUI)) + geom_point() # there are many intermediate cases which we can not distinguish a <- ggplot(full_master, aes(x = meanLUI, y = distLUI, colour = LUI.y)) + geom_point() + scale_color_gradient(low="blue", high="red") b <- ggplot(full_master, aes(x = meanLUI, y = distLUI, colour = LUI.x)) + geom_point() + scale_color_gradient(low="blue", high="red") plot_grid(a, b, nrow = 2, align = T) # mit diesen 3 informationen sollte jeder Wert eindeutig zuordenbar sein # saved as data_assembly/plots/21-03-11_introductory_plots_meanLUI_distLUI_ambiguity.pdf
preparing alpha-diversity
master_alpha <- data.table::data.table(master_alpha) master_alpha <- master_alpha[Var1 %in% plotNAset] ggmaster_alpha <- melt(master_alpha, id.vars = "Var1")
preparing beta-diversity
# clean dataset (copied from above) masterdiversity <- data.table::data.table(masterdiversity) masterdiversity <- masterdiversity[Var1 %in% plotNAset & Var2 %in% plotNAset, ] betacols <- c("Var1", "Var2", grep("beta", names(masterdiversity), value = T)) masterbeta <- masterdiversity[, ..betacols] masterbeta[, plot := paste(Var1, Var2, sep = "_")] masterbeta[, Var1 := NULL] masterbeta[, Var2 := NULL] # prepare ggplot dataset gmasterbeta <- melt(masterbeta, id.vars = "plot", value.name = "betadiversity", variable.name = "names") # get colors for plotting gmasterbeta <- merge(nicenames[, .(names, nicenames, color)], gmasterbeta, by = "names", all.y = T)
ggplot(gmasterbeta, aes(x = nicenames, y = betadiversity, fill = color)) + geom_jitter(size = 0.5, position = position_jitter(0.3)) + geom_violin() + theme_cowplot() + scale_fill_identity() + theme(axis.text.x = element_text(angle = 90, vjust = 0.5, hjust=1))
Why are some betadiversities discrete? - groups with few species, e.g. arthropodsoillarvae can not take so many beta values - groups with low alpha per plot (can also happen for groups with high overall richness, which have high dissimilarity across plots --> only a small subset of overall richenss colonizes a plot)
How do differences in alpha-diversity (richness) correspond to betadiversity?
Prepare alpha-diversity dataset : calculating pairwise differences in richness
richness_diff <- masterbeta[, .(Var1, Var2)] richness_diff <- merge(richness_diff, master_alpha, by = "Var1", all = T)
# edit bacteria.RNA : divide by 100 edit_ggmaster_alpha <- copy(ggmaster_alpha) edit_ggmaster_alpha[variable == "bacteria.RNA.alpha", value := value / 100] edit_ggmaster_alpha[variable == "bacteria.RNA.alpha", variable := "bacteria.RNA.alpha.div100"]
Example plot AEG01
# ultra-high number of bacteria # show 2 plots, one with all and one with just the small data plotname <- "AEG48" a <- ggplot(data = ggmaster_alpha[Var1 == plotname, .(variable, value)], aes(x = variable, y = value, fill = variable)) + geom_bar(stat = "identity") + theme(axis.text.x = element_blank()) + scale_fill_manual(values = longpallette) + labs(title = plotname, x = "", y = "alpha diversity") + theme(legend.position = "none") legend <- cowplot::get_legend(a) b <- a + ylim(c(0, 480))+ labs(title = "") + theme(legend.position = "none") c <- a + ylim(c(0, 40)) + labs(title = "") + theme(legend.position = "none") plot_grid(a, NULL, b, plot_grid(legend), c, NULL, nrow = 3, align = T, rel_widths = c(0.5, 0.2)) # saved as : 21-03-11_introductory_plots_alpha_diversity_plot_AEG01
Violin plot over all plots
a <- ggplot(data = edit_ggmaster_alpha, aes(x = variable, y = value, fill = variable)) + geom_violin() + ylim(c(0, 540)) + theme(axis.text.x = element_blank(), legend.position = "none") + scale_fill_manual(values = longpallette) + labs(title = "alpha diversity over all plots", x = "", y = "alpha diversity") legend <- cowplot::get_legend(a) b <- a + ylim(c(0, 100)) + labs(title = "") plot_grid(a, legend, b, NULL, rel_widths = c(0.6, 0.3)) # saved as : 21-03-11_introductory_plots_alpha_diversity_over_all_plots
#TODO probably remove this, only done for seminar presentation april 2023 select_col <- grep("turnover", names(EFmaster), value = T) select_to <- EFmaster[, ..select_col] select_to <- melt(select_to, measure.vars = select_col) select_to$threshold <- as.numeric(sub("EFturnover_", "", select_to$variable)) select_to$names <- as.character(select_to$threshold) vp_to <- ggplot(select_to, aes(x = names, y = value, fill = threshold)) + geom_violin() + scale_fill_gradient(low = "chartreuse2", high = "chartreuse4") + geom_point(position = position_jitter(seed = 1, width = 0.35), size = 0.4, colour = "gray") + theme_half_open() + theme(legend.position = "none", text = element_text(size = 20)) + xlab("") + ylab("beta-multifunctionality turnover") # violin plot of single functoins #TODO need to chose by hand single functions EFmaster select_col <- grep("Var1|Var2", names(EFmaster), value = T, invert = T) select_single <- melt(EFmaster, measure.vars = select_col) vp_sf <- ggplot(select_single, aes(x = variable, y = value, fill = variable)) + geom_point(position = position_jitter(seed = 1, width = 0.4), size = 0.4, colour = "gray") + geom_violin() + scale_fill_hue(c = 45, l = 55) + theme_half_open() + theme(legend.position = "none", text = element_text(size = 20)) + theme(axis.text.x = element_text(angle = 90, hjust = 0.5, vjust = 0.5)) + xlab("") + ylab("distance in single functions") # scale_fill_brewer(palette = "Dark2") plot_grid(plotlist = list(vp_to, vp_sf), nrow = 2)
# summary stats over EFmaster a <- apply(EFmaster, 2, max) data.frame(a[3:30]) # % turnover and nestedness restab_percent_to_nes <- EFmaster[, .(Var1, Var2)] for(t in seq(0.1, 0.9, 0.1)){ i <- grep(t, names(EFmaster), value = T) subset <- EFmaster[, ..i] setnames(subset, old = i, new = sub("_", "", sub(t, "", i))) subset[, paste("percent_turnover", t, sep = "_") := 100 / EFbeta * EFturnover] subset[, paste("percent_nestedness", t, sep = "_") := 100 / EFbeta * EFnestedness] subset[apply(subset, 2, is.nan)] <- 0 # check subset[, check := 100 / EFbeta * EFturnover + 100 / EFbeta * EFnestedness] plot(subset$check) # all values are 100 # rename and add to new dataset i <- c("EFbeta", "EFturnover", "EFnestedness", "check") subset[, (i) := NULL] restab_percent_to_nes <- cbind(restab_percent_to_nes, subset) rm(subset) } # summary stats summary(restab_percent_to_nes) # visualise results ggplot(restab_percent_to_nes, aes(x = percent_turnover_0.1, y = percent_nestedness_0.1)) + geom_jitter(width = 8, shape = 1) + xlim(c(0, 100)) + ggtitle(label = "threshold = 0.1") ggplot(restab_percent_to_nes, aes(x = percent_turnover_0.9, y = percent_nestedness_0.9)) + geom_jitter(width = 8, shape = 1) + xlim(c(0, 100)) + ggtitle(label = "threshold = 0.9") plot(restab_percent_to_nes$percent_turnover_0.2, restab_percent_to_nes$percent_nestedness_0.2) plot(restab_percent_to_nes$percent_turnover_0.1, restab_percent_to_nes$percent_nestedness_0.1) restab_melted <- melt(restab_percent_to_nes, id.vars = c("Var1", "Var2")) p <- ggplot(restab_melted, aes(x=variable, y=value)) + geom_violin(fill = "#A4A4A4") + coord_flip() restab_melted[, component := "nestedness"] restab_melted[grep("turnover", restab_melted$variable), component := "turnover"] table(restab_melted$component) # quick check aggregate(value ~ component, restab_melted, mean) aggregate(value ~ component, restab_melted, sd)
a <- ggplot(EFmaster, aes(x = EFturnover_0.8, y = EFnestedness_0.8, colour = EFbeta_0.8)) + geom_jitter(aes(size = EFbeta_0.8)) + scale_color_gradient(low="lightseagreen", high="orangered3") b <- ggplot(EFmaster, aes(x = EFturnover_0.8, y = EFnestedness_0.8, colour = EFdistance)) + geom_jitter(aes(size = EFdistance)) + scale_color_gradient(low="lightseagreen", high="orangered3") plot_grid(a, b)
M <- cor(EFmaster[, -"Var1"][, -"Var2"]) corrplot::corrplot(M,type="lower", addCoef.col = "black", method="color", diag=F, tl.srt=1, tl.col="black", mar=c(0,0,0,0), number.cex=0.4, order = "hclust", tl.cex = 0.6) corrplot::corrplot(M,type="lower", addCoef.col = "black", method="color", diag=F, tl.srt=1, tl.col="black", mar=c(0,0,0,0), number.cex=0.4, tl.cex = 0.6)
# read in dataset lui <- data.table(readRDS(paste(pathtodata, "/data_assembly/output_data/LUI.rds", sep = ""))) funs <- readRDS(paste(pathtodata, "/data_assembly/output_data/imputed_and_compound_grlfuns.rds", sep = "")) # FUNCTION LEVELS # create heatmap dat <- merge(lui[, .(Plotn, LUI)], funs, by = "Plotn") setorder(dat, LUI) # sort by LUI dat <- cbind(dat[, 1], apply(dat[, -"Plotn"], 2, scale01)) mdat <- as.matrix(t(dat[, -"Plotn"])) colnames(mdat) <- dat$Plotn heatmap(mdat, scale = "none", Colv = NA, main = "Function levels along the LUI gradient")# , Rowv = NA) # saved as : introductory_plots_heatmap_function_levels_along_LUI_gradient.pdf # went through differen thresholds and combined the output pdfs to 1 : introductory_plots_heatmap_functions_along_LUI_gradient # FUNCTION PRESENCE-ABSENCE # calc presence-absence based on given threshold funs_pa <- data.table::copy(funs) threshold <- 0.2 include <- names(funs_pa)[!names(funs_pa) %in% "Plotn"] funs_pa[, (include) := lapply(.SD, function(c) calc_presenceabsence(c, threshold = threshold, type = "max5")), .SDcols = include] funs_pa[, (include) := (.SD * 1), .SDcols = include] # create heatmap dat <- merge(lui[, .(Plotn, LUI)], funs_pa, by = "Plotn") setorder(dat, LUI) # sort by LUI mdat <- as.matrix(t(dat[, -"Plotn"])) colnames(mdat) <- dat$Plotn heatmap(mdat, scale = "none", Colv = NA, main = paste("threshold :", threshold), xlab = "LUI: AEG02 has highest LUI") # heatmap(mdat, scale = "none") # saved as : introductory_plots_heatmap_function_pa0.3_along_LUI_gradient # went through differen thresholds and combined the output pdfs to 1 : introductory_plots_heatmap_functions_along_LUI_gradient
Plot comparisons with high EFdist (> 0.8):
High EFdistance, high turnover and low nestedness SEG17 AEG02 1.0000000 0.8333333 0.01282051 HEG38 AEG02 0.8628104 0.8000000 0.03333333
High EFdistance, low turnover and high nestedness (nes goes only until 0.55, so this is very high) SEG22 AEG49 0.8823974 0.3333333 0.26666667 SEG22 HEG30 0.8545400 0.3333333 0.26666667
Filter for high nestedness: if nes is at its max, turnover is always 0! HEG11 AEG19 0.3787118 0 0.5555556 SEG22 HEG20 0.7917539 0 0.5555556 also if nestedness is > 0.4 --> high nes cases are 0 turnover cases!
sections_to_be_loaded <- c("functions_dissimilarity") source("vignettes/analysis_nonpublic.R") #TODO HERE : summary stats of these cases. # note that somehow. # EFmastser : read in from analysis_nonpublic.R # find high distance comparisons highdist <- EFmaster[EFdistance > 0.85, .(Var1, Var2, EFdistance, EFturnover_0.6, EFnestedness_0.6)] highdist <- EFmaster[EFnestedness_0.6 > 0.5, .(Var1, Var2, EFdistance, EFturnover_0.6, EFnestedness_0.6)] highdist <- EFmaster[EFnestedness_0.6 > 0.4 & EFnestedness_0.6 < 0.55, .(Var1, Var2, EFdistance, EFturnover_0.6, EFnestedness_0.6)] unique(highdist$EFturnover_0.6) # HEG38 AEG02 : 0.8628104 (EFdistance), EFturnover > 0.8, EFnes : 0.03 (very low) a <- ggplot(EFmaster, aes(x = EFdistance, y = EFturnover_0.1, colour = EFnestedness_0.1)) + geom_jitter(aes(size = EFnestedness_0.1)) + scale_color_gradient(low="lightseagreen", high="orangered3") b <- ggplot(EFmaster, aes(x = EFdistance, y = EFturnover_0.6, colour = EFnestedness_0.6)) + geom_jitter(aes(size = EFnestedness_0.6)) + scale_color_gradient(low="lightseagreen", high="orangered3") c <- ggplot(EFmaster, aes(x = EFdistance, y = EFturnover_0.7, colour = EFnestedness_0.7)) + geom_jitter(aes(size = EFnestedness_0.7)) + scale_color_gradient(low="lightseagreen", high="orangered3") d <- ggplot(EFmaster, aes(x = EFdistance, y = EFturnover_0.8, colour = EFnestedness_0.8)) + geom_jitter(aes(size = EFnestedness_0.8)) + scale_color_gradient(low="lightseagreen", high="orangered3") plot_grid(a, b, c, d, nrow = 2) data.table(readRDS(paste(pathtodata, "/data_assembly/output_data/LUI.rds", sep = ""))) funs <- readRDS(paste(pathtodata, "/data_assembly/output_data/imputed_and_compound_grlfuns.rds", sep = ""))
# read in dataset lui <- data.table(readRDS(paste(pathtodata, "/data_assembly/output_data/LUI.rds", sep = ""))) funs <- readRDS(paste(pathtodata, "/data_assembly/output_data/imputed_and_compound_grlfuns.rds", sep = "")) dat <- merge(lui[, .(Plotn, LUI)], funs, by = "Plotn") m <- cor(dat[, -"Plotn"], use = "pairwise.complete.obs") M <- data.frame("LUI" = sort(m[-1, 1])) M$functions <- rownames(M) M$functions <- factor(M$functions, levels = M$functions) ggplot(data.frame(M), aes(x = functions, y = LUI)) + geom_bar(stat = "identity") + ylab("Correlation with LUI") + xlab("") + theme_cowplot() + theme(axis.text.x=element_text(angle=90,hjust=1,vjust=0.5)) # saved as : "22-08-25_single_funs_corr_with_LUI.pdf" # corrplot::corrplot(m, type="lower", addCoef.col = "black", method="color", diag=F, tl.srt=1, tl.col="black", mar=c(1,0,1,0), number.cex=0.6)
# requires EFmaster sections_to_be_loaded <- c("functions_dissimilarity", "LUI") source("vignettes/analysis_nonpublic.R") funs <- readRDS(paste(pathtodata, "/data_assembly/output_data/imputed_and_compound_grlfuns.rds", sep = "")) setcolorder(funs, c("Plotn")) # transform single functions to % --> interpret as "high" or "low" trans_funs <- data.table(apply(funs[, -1], 2, function(x) x / maxx(x, 5))) trans_funs$Plotn <- funs$Plotn trans_funs <- merge(trans_funs, LUI[, 1:2], by = "Plotn") highturnoverpairs <- EFmaster[EFturnover_0.7 > 0.8, .(Var1, Var2)] # plot pairs with high turnover i <- 6 trans_funs[Plotn %in% as.character(unlist(highturnoverpairs[i, ]))] #example within region x <- sort(abs(apply(trans_funs[Plotn %in% c("AEG13", "AEG10"), -1], 2, diff))) par(mar=c(11,4,4,4)) barplot(x, las = 2) y <- sort(abs(apply(trans_funs[Plotn %in% c("SEG07", "SEG43"), -1], 2, diff))) par(mar=c(11,4,4,4)) barplot(y, las = 2)
#TODO
ggplot(full_master, aes(x = EFturnover_0.7, y = EFnestedness_0.7, colour = EFbeta_0.7)) + geom_point()
par(mfrow = c(2,1)) plot(full_master$autotroph.beta.sim, main = "Autotroph betadiversity", sub = "turnover (above) and nestedness (below)", xlab = "pairwise comparisons of plots", ylab = "autotroph betadiversity") plot(full_master$autotroph.beta.sne, xlab = "pairwise comparisons of plots", ylab = "autotroph betadiversity") ggplot(full_master, aes(x = autotroph.beta.sim, y = autotroph.beta.sne, colour = EFbeta_0.7)) + scale_color_gradient(low="blue", high="red") + geom_point() # saved as : 21-03-11_introductory_plots_autotroph_betadiversity_turnover_nestedness_EFdist
test <- full_master[autotroph.beta.sim > 0.95, .(Var1, Var2, EFdistance, EFbeta_0.7, EFturnover_0.7, EFnestedness_0.7, distLUI, LUI.x, LUI.y, autotroph.beta.sim, autotroph.beta.sne, herbivore.arthropod.beta.sim, herbivore.arthropod.beta.sne, symbiont.soilfungi.beta.sim, symbiont.soilfungi.beta.sne)] test[, comparison := paste(Var1, Var2, sep = "_")] test[, Var1 := NULL] test[, Var2 := NULL] test <- melt(test, id.vars = "comparison") ggplot(test, aes(x = variable, y = value, colour = comparison, group = comparison)) + geom_hline(yintercept = 1) + geom_line() + geom_point(aes(size = 3)) + scale_colour_manual(values = longpallette) + labs(title = "specific case descriptions", subtitle = "extraction from dataset \n8 comparisons, selected by highest autotroph beta turnover", x = "", y = "distance or absolute value") + theme(axis.text.x = element_text(angle = 90)) # saved as : 21-03-11_introductory_plots_specific_case_high_autotroph_betadiversity_turnover_EFdist_LUI
test <- full_master[autotroph.beta.sne > 0.4, .(Var1, Var2, EFdistance, EFbeta_0.7, EFturnover_0.7, EFnestedness_0.7, distLUI, LUI.x, LUI.y, autotroph.beta.sim, autotroph.beta.sne, herbivore.arthropod.beta.sim, herbivore.arthropod.beta.sne, symbiont.soilfungi.beta.sim, symbiont.soilfungi.beta.sne)] test[, comparison := paste(Var1, Var2, sep = "_")] test[, Var1 := NULL] test[, Var2 := NULL] test <- melt(test, id.vars = "comparison") ggplot(test, aes(x = variable, y = value, colour = comparison, group = comparison)) + geom_hline(yintercept = 1) + geom_line() + geom_point(aes(size = 3)) + scale_colour_manual(values = longpallette) + labs(title = "specific case descriptions", subtitle = "extraction from dataset \n8 comparisons, selected by highest autotroph beta nestedness", x = "", y = "distance or absolute value") + theme(axis.text.x = element_text(angle = 90)) # saved as : 21-03-11_introductory_plots_specific_case_high_autotroph_betadiversity_nestedness_EFdist_LUI
plot(full_master$EFdistance) test <- full_master[EFdistance > 0.93, .(Var1, Var2, EFdistance, EFbeta_0.7, EFturnover_0.7, EFnestedness_0.7, distLUI, LUI.x, LUI.y, autotroph.beta.sim, autotroph.beta.sne, herbivore.arthropod.beta.sim, herbivore.arthropod.beta.sne, symbiont.soilfungi.beta.sim, symbiont.soilfungi.beta.sne)] test[, comparison := paste(Var1, Var2, sep = "_")] test[, Var1 := NULL] test[, Var2 := NULL] test <- melt(test, id.vars = "comparison") ggplot(test, aes(x = variable, y = value, colour = comparison, group = comparison)) + geom_hline(yintercept = 1) + geom_line() + geom_point(aes(size = 3)) + scale_colour_manual(values = longpallette) + labs(title = "specific case descriptions", subtitle = "extraction from dataset \n8 comparisons, selected by highest EFdistance", x = "", y = "distance or absolute value") + theme(axis.text.x = element_text(angle = 90)) # saved as : 21-03-11_introductory_plots_specific_case_high_EFdist_LUI_selected_beta
plot(full_master$EFnestedness_0.7) test <- full_master[EFnestedness_0.7 > 0.7, .(Var1, Var2, EFdistance, EFbeta_0.7, EFturnover_0.7, EFnestedness_0.7, distLUI, LUI.x, LUI.y, autotroph.beta.sim, autotroph.beta.sne, herbivore.arthropod.beta.sim, herbivore.arthropod.beta.sne, symbiont.soilfungi.beta.sim, symbiont.soilfungi.beta.sne)] test[, comparison := paste(Var1, Var2, sep = "_")] test[, Var1 := NULL] test[, Var2 := NULL] test <- test[sample(1:nrow(test), 8), ] test <- melt(test, id.vars = "comparison") ggplot(test, aes(x = variable, y = value, colour = comparison, group = comparison)) + geom_hline(yintercept = 1) + geom_line() + geom_point(aes(size = 3)) + scale_colour_manual(values = longpallette) + labs(title = "specific case descriptions", subtitle = "extraction from dataset \n8 comparisons, selected by highest EFnestedness0.7", x = "", y = "distance or absolute value") + theme(axis.text.x = element_text(angle = 90)) # saved as : 21-03-11_introductory_plots_specific_case_high_EFnestedness_LUI_selected_beta
ggplot(full_master, aes(x = distLUI, y = EFdistance, colour = autotroph.beta.sne)) + geom_point() a <- ggplot(full_master, aes(x = distLUI, y = autotroph.beta.sne, colour = EFdistance)) + geom_point() + geom_smooth(method = "lm", se = F) b <- ggplot(full_master, aes(x = distLUI, y = autotroph.beta.sim, colour = EFdistance)) + geom_point() + geom_smooth(method = "lm", se = F)
moving window of EFdist for LUI autotroph beta connection
a <- ggplot(full_master[EFdistance < 0.2], aes(x = distLUI, y = autotroph.beta.sim)) + geom_point() + geom_smooth(method = "lm", se = F) + labs(subtitle = "EFdist in {0, 0.2}") b <- ggplot(full_master[EFdistance > 0.2 & EFdistance < 0.4], aes(x = distLUI, y = autotroph.beta.sim)) + geom_point() + geom_smooth(method = "lm", se = F) + labs(subtitle = "EFdist in {0.2, 0.4}") c <- ggplot(full_master[EFdistance > 0.4 & EFdistance < 0.6], aes(x = distLUI, y = autotroph.beta.sim)) + geom_point() + geom_smooth(method = "lm", se = F) + labs(subtitle = "EFdist in {0.4, 0.6}") d <- ggplot(full_master[EFdistance > 0.6 & EFdistance < 0.75], aes(x = distLUI, y = autotroph.beta.sim)) + geom_point() + geom_smooth(method = "lm", se = F) + labs(subtitle = "EFdist in {0.6, 0.75}") e <- ggplot(full_master[EFdistance > 0.75], aes(x = distLUI, y = autotroph.beta.sim)) + geom_point() + geom_smooth(method = "lm", se = F) + labs(subtitle = "EFdist in {0.75, 1}") plot_grid(a, b, c, d, e, NULL, NULL, NULL, NULL, NULL, nrow = 2)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.