Created
March 31, 2014 21:25
-
-
Save jebyrnes/9902740 to your computer and use it in GitHub Desktop.
A multifunctionality analysis using the threshold effect for Biodepth in Germany using the Zissou color scheme from Karthik's wesanderson package for color palates.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(multifunc) | |
library(wesanderson) | |
data(all_biodepth) | |
allVars<-qw(biomassY3, root3, N.g.m2, light3, N.Soil, wood3, cotton3) | |
germany<-subset(all_biodepth, all_biodepth$location=="Germany") | |
vars<-whichVars(germany, allVars) | |
#re-normalize N.Soil so that everything is on the same sign-scale (e.g. the maximum level of a function is the "best" function) | |
germany$N.Soil<- -1*germany$N.Soil +max(germany$N.Soil, na.rm=TRUE) | |
germanyThresh<-getFuncsMaxed(germany, vars, threshmin=0.05, threshmax=0.99, prepend=c("plot","Diversity"), maxN=7) | |
pal <- wes.palette(5, "Zissou") | |
ggplot(data=germanyThresh, aes(x=Diversity, y=funcMaxed, group=thresholds)) + | |
stat_smooth(method="glm", family=quasipoisson(link="identity"), pwd=0.8, aes(fill=thresholds, color=thresholds))+ | |
scale_colour_gradientn(name="Threshold", colours =pal) + | |
# theme_minimal(base_size=24)+ | |
theme_classic(base_size=24)+ | |
scale_fill_gradientn(name="Threshold", colours =pal) + | |
xlab("Species Richness") + ylab("# Functions ≥ Threshold\n") + | |
theme(text=element_text(family="Tw Cen MT")) + ggtitle("Germany") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment