Schefferville - transitions; Species contribution to beta diversity

Tammy L. Elliott

Date: March 28, 2015

R version 3.1.0

# set global chunk options: 
library(knitr)
opts_chunk$set(cache=FALSE, fig.align='center')

Sample code of how species contribution to beta diversity calculated from environmental distances.


For all of the SCBD, Hellinger distances were used to calculate the beta diversity values.

Clusters were formed from five different methods - environmental distances, phylogenetic beta diversity of vasculars, weighted phylogenetic beta diversity of vasculars, phylogenetic beta diversity of angiosperms, and weighted phylogenetic beta diversity of angiosperms.

# Species contribution to beta diversity across three environmental distance clusters

abd.sp.groups.3<- cbind(abd.sp.allsp, vasc.env.clust.3$cluster)
colnames(abd.sp.groups.3)[which(colnames(abd.sp.groups.3) == "")] <- "Group"
Three.clust.1<-subset(abd.sp.groups.3,abd.sp.groups.3[,126]=="1")
Three.clust.2<-subset(abd.sp.groups.3,abd.sp.groups.3[,126]=="2")
Three.clust.3<-subset(abd.sp.groups.3,abd.sp.groups.3[,126]=="3")

 # Check - the following should equal 176
nrow(Three.clust.1)+nrow(Three.clust.2)+nrow(Three.clust.3)
## [1] 176
# Species contribution to beta diversity across four environmental distance clusters
abd.sp.groups.4<- cbind(abd.sp.allsp, vasc.env.clust.4$cluster)
colnames(abd.sp.groups.4)[which(colnames(abd.sp.groups.4) == "")] <- "Group"
Four.clust.1<-subset(abd.sp.groups.4,abd.sp.groups.4[,126]=="1")
Four.clust.2<-subset(abd.sp.groups.4,abd.sp.groups.4[,126]=="2")
Four.clust.3<-subset(abd.sp.groups.4,abd.sp.groups.4[,126]=="3")
Four.clust.4<-subset(abd.sp.groups.4,abd.sp.groups.4[,126]=="4")

#Species contribution to beta diversity across five environmental distance clusters
abd.sp.groups.5<- cbind(abd.sp.allsp, vasc.env.clust.5$cluster)
colnames(abd.sp.groups.5)[which(colnames(abd.sp.groups.5) == "")] <- "Group"
Five.clust.1<-subset(abd.sp.groups.5,abd.sp.groups.5[,126]=="1")
Five.clust.2<-subset(abd.sp.groups.5,abd.sp.groups.5[,126]=="2")
Five.clust.3<-subset(abd.sp.groups.5,abd.sp.groups.5[,126]=="3")
Five.clust.4<-subset(abd.sp.groups.5,abd.sp.groups.5[,126]=="4")
Five.clust.5<-subset(abd.sp.groups.5,abd.sp.groups.5[,126]=="5")


# Calculate species contributions to beta diversity with hellinger distances

#First calculate the local contribution to betadiversity for the angiosperm only data
env.res.1.3 <- beta.div(Three.clust.1[,1:125], "hellinger", nperm=999)
#get species BD scores
env.clust.1.3.SCBD<-env.res.1.3$SCBD

env.res.2.3 <- beta.div(Three.clust.2[,1:125], "hellinger", nperm=999)
#get species BD scores
env.clust.2.3.SCBD<-env.res.2.3$SCBD

env.res.3.3 <- beta.div(Three.clust.3[,1:125], "hellinger", nperm=999)
#get species BD scores
env.clust.3.3.SCBD<-env.res.3.3$SCBD

SCBD of different species across environmental distance clusters.

Species contribution to beta diversity across three environmental distance clusters

#plot all  angiosperm contMaps side-by-side
#dev.new(width=11.8, height=8)
par(mfrow=c(1,3), mar=c(4, 4, 0, 1), mai=c(4, 0, 0, 0))
#Black and white ContMap
env.1.3.map$cols[]<-grey(seq(1,0,length.out=length(env.1.3.map$cols)))
plot(env.1.3.map,outline=TRUE,lwd=3, res=10,  ftype="b",sig=2,legend=FALSE, fsize=0.35)
#add.color.bar(420, env.1.3.map$cols, lims=c(0,0.106),title="Species contribution to beta diversity", digits=3, prompt=TRUE, lwd=3, outline=TRUE, fsize=0.6, ftype="b")

#Black and white ContMap for angiosperms only
env.2.3.map$cols[]<-grey(seq(1,0,length.out=length(env.2.3.map$cols)))
plot(env.2.3.map,outline=TRUE,lwd=3, res=10,  ftype="b",sig=2,legend=FALSE, fsize=0.35)
#add.color.bar(420, env.2.3.map$cols, lims=c(0,0.106),title="Species contribution to beta diversity", digits=3, prompt=TRUE, lwd=3, outline=TRUE, fsize=0.6, ftype="b")

env.3.3.map$cols[]<-grey(seq(1,0,length.out=length(env.3.3.map$cols)))
plot(env.3.3.map,outline=TRUE,lwd=3, res=10,  ftype="b",sig=2,legend=FALSE, fsize=0.35)

#add.color.bar(420, env.3.3.map$cols, lims=c(0,0.106),title="Species contribution to beta diversity", digits=3, prompt=TRUE, lwd=3, outline=TRUE, fsize=0.6, ftype="b")

Species contribution to beta diversity across four environmental distance clusters

#plot all angioular and angiosperm contMaps side-by-side for four clusters
#dev.new(width=11.8, height=8)
par(mfrow=c(1,4), mar=c(4, 4, 0, 1), mai=c(4, 0, 0, 0))
#Black and white ContMap
env.1.4.map$cols[]<-grey(seq(1,0,length.out=length(env.1.4.map$cols)))
plot(env.1.4.map,outline=TRUE,lwd=3, res=10,  ftype="b",sig=2,legend=FALSE, fsize=0.35)
#add.color.bar(420, env.1.4.map$cols, lims=c(0,0.106),title="Species contribution to beta diversity", digits=3, prompt=TRUE, lwd=3, outline=TRUE, fsize=0.6, ftype="b")

env.2.4.map$cols[]<-grey(seq(1,0,length.out=length(env.2.4.map$cols)))
plot(env.2.4.map,outline=TRUE,lwd=3, res=10,  ftype="b",sig=2,legend=FALSE, fsize=0.35)
#add.color.bar(420, env.2.4.map$cols, lims=c(0,0.106),title="Species contribution to beta diversity", digits=3, prompt=TRUE, lwd=3, outline=TRUE, fsize=0.6, ftype="b")

env.3.4.map$cols[]<-grey(seq(1,0,length.out=length(env.3.4.map$cols)))
plot(env.3.4.map,outline=TRUE,lwd=3, res=10,  ftype="b",sig=2,legend=FALSE, fsize=0.35)
#add.color.bar(420, env.3.4.map$cols, lims=c(0,0.106),title="Species contribution to beta diversity", digits=3, prompt=TRUE, lwd=3, outline=TRUE, fsize=0.6, ftype="b")

env.4.4.map$cols[]<-grey(seq(1,0,length.out=length(env.4.4.map$cols)))
plot(env.4.4.map,outline=TRUE,lwd=3, res=10,  ftype="b",sig=2,legend=FALSE, fsize=0.35)

#add.color.bar(420, env.4.4.map$cols, lims=c(0,0.106),title="Species contribution to beta diversity", digits=3, prompt=TRUE, lwd=3, outline=TRUE, fsize=0.6, ftype="b")

Species contribution to beta diversity across five environmental distance clusters

#plot all angioular and angiosperm contMaps side-by-side for four clusters
#dev.new(width=11.8, height=8)
par(mfrow=c(1,5), mar=c(4, 4, 0, 1), mai=c(4, 0, 0, 0))
#Black and white ContMap
env.1.5.map$cols[]<-grey(seq(1,0,length.out=length(env.1.5.map$cols)))
plot(env.1.5.map,outline=TRUE,lwd=3, res=10,  ftype="b",sig=2,legend=FALSE, fsize=0.35)
#add.color.bar(420, env.1.5.map$cols, lims=c(0,0.106),title="Species contribution to beta diversity", digits=3, prompt=TRUE, lwd=3, outline=TRUE, fsize=0.6, ftype="b")

env.2.5.map$cols[]<-grey(seq(1,0,length.out=length(env.2.5.map$cols)))
plot(env.2.5.map,outline=TRUE,lwd=3, res=10,  ftype="b",sig=2,legend=FALSE, fsize=0.35)
#add.color.bar(420, env.2.5.map$cols, lims=c(0,0.106),title="Species contribution to beta diversity", digits=3, prompt=TRUE, lwd=3, outline=TRUE, fsize=0.6, ftype="b")

env.3.5.map$cols[]<-grey(seq(1,0,length.out=length(env.3.5.map$cols)))
plot(env.3.5.map,outline=TRUE,lwd=3, res=10,  ftype="b",sig=2,legend=FALSE, fsize=0.35)
#add.color.bar(420, env.3.5.map$cols, lims=c(0,0.106),title="Species contribution to beta diversity", digits=3, prompt=TRUE, lwd=3, outline=TRUE, fsize=0.6, ftype="b")

env.4.5.map$cols[]<-grey(seq(1,0,length.out=length(env.4.5.map$cols)))
plot(env.4.5.map,outline=TRUE,lwd=3, res=10,  ftype="b",sig=2,legend=FALSE, fsize=0.35)
#add.color.bar(420, env.4.5.map$cols, lims=c(0,0.106),title="Species contribution to beta diversity", digits=3, prompt=TRUE, lwd=3, outline=TRUE, fsize=0.6, ftype="b")

env.5.5.map$cols[]<-grey(seq(1,0,length.out=length(env.5.5.map$cols)))
plot(env.5.5.map,outline=TRUE,lwd=3, res=10,  ftype="b",sig=2,legend=FALSE, fsize=0.35)

#add.color.bar(420, env.5.5.map$cols, lims=c(0,0.106),title="Species contribution to beta diversity", digits=3, prompt=TRUE, lwd=3, outline=TRUE, fsize=0.6, ftype="b")

Phylogenetic beta diversity clusters for vasculars - sample code

# no abundance weighted, phylogenetic for vasculars
vasc.ph.pairs.abd0<-pairPhylo(tree, t(abd.sp.allsp), q=0)
vasc.ph.pairs.abd0.mat<-as.matrix(vasc.ph.pairs.abd0$CqN)
rownames(vasc.ph.pairs.abd0.mat)<-rownames(abd.sp.allsp)
colnames(vasc.ph.pairs.abd0.mat)<-rownames(abd.sp.allsp)

trans.dist<-dist(vasc.ph.pairs.abd0.mat)
# Make euclidean for further analyzes
head(sqrt(trans.dist))
## [1] 1.5915041 1.7298445 0.9721087 1.4180747 1.5518220 1.1105326
is.euclid(trans.dist)
## Warning in is.euclid(trans.dist): Zero distance(s)
## [1] TRUE
vasc.dist.clust.three<-kmeans(trans.dist,3)
vasc.dist.clust.four<-kmeans(trans.dist,4)
vasc.dist.clust.five<-kmeans(trans.dist,5)

SCBD of different species across phylogenetic beta diversity clusters (vasculars)

Three phylogenetic beta diversity clusters (vasculars)

#plot all vascular and angiosperm contMaps side-by-side
#dev.new(width=11.8, height=8)
par(mfrow=c(1,3), mar=c(4, 4, 0, 1), mai=c(4, 0, 0, 0))
#Black and white ContMap
phy.vasc.1.3.map$cols[]<-grey(seq(1,0,length.out=length(phy.vasc.1.3.map$cols)))
plot(phy.vasc.1.3.map,outline=TRUE,lwd=3, res=10,  ftype="b",sig=2,legend=FALSE, fsize=0.35)
#add.color.bar(420, phy.vasc.1.3.map$cols, lims=c(0,0.106),title="Species contribution to beta diversity", digits=3, prompt=TRUE, lwd=3, outline=TRUE, fsize=0.6, ftype="b")

#Black and white ContMap for angiosperms only
phy.vasc.2.3.map$cols[]<-grey(seq(1,0,length.out=length(phy.vasc.2.3.map$cols)))
plot(phy.vasc.2.3.map,outline=TRUE,lwd=3, res=10,  ftype="b",sig=2,legend=FALSE, fsize=0.35)
#add.color.bar(420, phy.vasc.2.3.map$cols, lims=c(0,0.106),title="Species contribution to beta diversity", digits=3, prompt=TRUE, lwd=3, outline=TRUE, fsize=0.6, ftype="b")

phy.vasc.3.3.map$cols[]<-grey(seq(1,0,length.out=length(phy.vasc.3.3.map$cols)))
plot(phy.vasc.3.3.map,outline=TRUE,lwd=3, res=10,  ftype="b",sig=2,legend=FALSE, fsize=0.35)

#add.color.bar(420, phy.vasc.3.3.map$cols, lims=c(0,0.106),title="Species contribution to beta diversity", digits=3, prompt=TRUE, lwd=3, outline=TRUE, fsize=0.6, ftype="b")

Four phylogenetic beta diversity clusters (vasculars)

#plot all vascular and angiosperm contMaps side-by-side
#dev.new(width=11.8, height=8)
par(mfrow=c(1,4), mar=c(4, 4, 0, 1), mai=c(4, 0, 0, 0))
#Black and white ContMap
phy.vasc.1.4.map$cols[]<-grey(seq(1,0,length.out=length(phy.vasc.1.4.map$cols)))
plot(phy.vasc.1.4.map,outline=TRUE,lwd=3, res=10,  ftype="b",sig=2,legend=FALSE, fsize=0.35)
#add.color.bar(420, phy.vasc.1.4.map$cols, lims=c(0,0.106),title="Species contribution to beta diversity", digits=3, prompt=TRUE, lwd=3, outline=TRUE, fsize=0.6, ftype="b")

phy.vasc.2.4.map$cols[]<-grey(seq(1,0,length.out=length(phy.vasc.2.4.map$cols)))
plot(phy.vasc.2.4.map,outline=TRUE,lwd=3, res=10,  ftype="b",sig=2,legend=FALSE, fsize=0.35)
#add.color.bar(420, phy.vasc.2.4.map$cols, lims=c(0,0.106),title="Species contribution to beta diversity", digits=3, prompt=TRUE, lwd=3, outline=TRUE, fsize=0.6, ftype="b")

phy.vasc.3.4.map$cols[]<-grey(seq(1,0,length.out=length(phy.vasc.3.4.map$cols)))
plot(phy.vasc.3.4.map,outline=TRUE,lwd=3, res=10,  ftype="b",sig=2,legend=FALSE, fsize=0.35)
#add.color.bar(420, phy.vasc.3.4.map$cols, lims=c(0,0.106),title="Species contribution to beta diversity", digits=3, prompt=TRUE, lwd=3, outline=TRUE, fsize=0.6, ftype="b")

phy.vasc.4.4.map$cols[]<-grey(seq(1,0,length.out=length(phy.vasc.4.4.map$cols)))
plot(phy.vasc.4.4.map,outline=TRUE,lwd=3, res=10,  ftype="b",sig=2,legend=FALSE, fsize=0.35)

#add.color.bar(420, phy.vasc.4.4.map$cols, lims=c(0,0.106),title="Species contribution to beta diversity", digits=3, prompt=TRUE, lwd=3, outline=TRUE, fsize=0.6, ftype="b")

Five phylogenetic beta diversity clusters (vasculars)

#plot all vascular and angiosperm contMaps side-by-side
#dev.new(width=11.8, height=8)
par(mfrow=c(1,5), mar=c(4, 4, 0, 1), mai=c(4, 0, 0, 0))
#Black and white ContMap
phy.vasc.1.5.map$cols[]<-grey(seq(1,0,length.out=length(phy.vasc.1.5.map$cols)))
plot(phy.vasc.1.5.map,outline=TRUE,lwd=3, res=10,  ftype="b",sig=2,legend=FALSE, fsize=0.35)
#add.color.bar(420, phy.vasc.1.5.map$cols, lims=c(0,0.106),title="Species contribution to beta diversity", digits=3, prompt=TRUE, lwd=3, outline=TRUE, fsize=0.6, ftype="b")

#Black and white ContMap for angiosperms only
phy.vasc.2.5.map$cols[]<-grey(seq(1,0,length.out=length(phy.vasc.2.5.map$cols)))
plot(phy.vasc.2.5.map,outline=TRUE,lwd=3, res=10,  ftype="b",sig=2,legend=FALSE, fsize=0.35)
#add.color.bar(420, phy.vasc.2.5.map$cols, lims=c(0,0.106),title="Species contribution to beta diversity", digits=3, prompt=TRUE, lwd=3, outline=TRUE, fsize=0.6, ftype="b")

phy.vasc.3.5.map$cols[]<-grey(seq(1,0,length.out=length(phy.vasc.3.5.map$cols)))
plot(phy.vasc.3.5.map,outline=TRUE,lwd=3, res=10,  ftype="b",sig=2,legend=FALSE, fsize=0.35)
#add.color.bar(420, phy.vasc.3.5.map$cols, lims=c(0,0.106),title="Species contribution to beta diversity", digits=3, prompt=TRUE, lwd=3, outline=TRUE, fsize=0.6, ftype="b")

phy.vasc.4.5.map$cols[]<-grey(seq(1,0,length.out=length(phy.vasc.4.5.map$cols)))
plot(phy.vasc.4.5.map,outline=TRUE,lwd=3, res=10,  ftype="b",sig=2,legend=FALSE, fsize=0.35)
#add.color.bar(420, phy.vasc.4.5.map$cols, lims=c(0,0.106),title="Species contribution to beta diversity", digits=3, prompt=TRUE, lwd=3, outline=TRUE, fsize=0.6, ftype="b")

phy.vasc.5.5.map$cols[]<-grey(seq(1,0,length.out=length(phy.vasc.5.5.map$cols)))
plot(phy.vasc.5.5.map,outline=TRUE,lwd=3, res=10,  ftype="b",sig=2,legend=FALSE, fsize=0.35)

#add.color.bar(420, phy.vasc.5.5.map$cols, lims=c(0,0.106),title="Species contribution to beta diversity", digits=3, prompt=TRUE, lwd=3, outline=TRUE, fsize=0.6, ftype="b")

SCBD of different species across weighted phylogenetic beta diversity clusters (vasculars)

Three cluster groupings for vascular abundance weighting; phylogenetic beta diversity

#plot all vascular and angiosperm contMaps side-by-side
#dev.new(width=11.8, height=8)
par(mfrow=c(1,3), mar=c(4, 4, 0, 1), mai=c(4, 0, 0, 0))
#Black and white ContMap
phy.abd.vasc.1.3.map$cols[]<-grey(seq(1,0,length.out=length(phy.abd.vasc.1.3.map$cols)))
plot(phy.abd.vasc.1.3.map,outline=TRUE,lwd=3, res=10,  ftype="b",sig=2,legend=FALSE, fsize=0.35)
#add.color.bar(420, phy.abd.vasc.1.3.map$cols, lims=c(0,0.106),title="Species contribution to beta diversity", digits=3, prompt=TRUE, lwd=3, outline=TRUE, fsize=0.6, ftype="b")

#Black and white ContMap for angiosperms only
phy.abd.vasc.2.3.map$cols[]<-grey(seq(1,0,length.out=length(phy.abd.vasc.2.3.map$cols)))
plot(phy.abd.vasc.2.3.map,outline=TRUE,lwd=3, res=10,  ftype="b",sig=2,legend=FALSE, fsize=0.35)
#add.color.bar(420, phy.abd.vasc.2.3.map$cols, lims=c(0,0.106),title="Species contribution to beta diversity", digits=3, prompt=TRUE, lwd=3, outline=TRUE, fsize=0.6, ftype="b")

phy.abd.vasc.3.3.map$cols[]<-grey(seq(1,0,length.out=length(phy.abd.vasc.3.3.map$cols)))
plot(phy.abd.vasc.3.3.map,outline=TRUE,lwd=3, res=10,  ftype="b",sig=2,legend=FALSE, fsize=0.35)

#add.color.bar(420, phy.abd.vasc.3.3.map$cols, lims=c(0,0.106),title="Species contribution to beta diversity", digits=3, prompt=TRUE, lwd=3, outline=TRUE, fsize=0.6, ftype="b")

Four cluster groupings for vascular abundance weighting; phylogenetic beta diversity

#plot all vascular and angiosperm contMaps side-by-side
#dev.new(width=11.8, height=8)
par(mfrow=c(1,4), mar=c(4, 4, 0, 1), mai=c(4, 0, 0, 0))
#Black and white ContMap
phy.abd.vasc.1.4.map$cols[]<-grey(seq(1,0,length.out=length(phy.abd.vasc.1.4.map$cols)))
plot(phy.abd.vasc.1.4.map,outline=TRUE,lwd=3, res=10,  ftype="b",sig=2,legend=FALSE, fsize=0.35)
#add.color.bar(420, phy.abd.vasc.1.4.map$cols, lims=c(0,0.106),title="Species contribution to beta diversity", digits=3, prompt=TRUE, lwd=3, outline=TRUE, fsize=0.6, ftype="b")

#Black and white ContMap for angiosperms only
phy.abd.vasc.2.4.map$cols[]<-grey(seq(1,0,length.out=length(phy.abd.vasc.2.4.map$cols)))
plot(phy.abd.vasc.2.4.map,outline=TRUE,lwd=3, res=10,  ftype="b",sig=2,legend=FALSE, fsize=0.35)
#add.color.bar(420, phy.abd.vasc.2.4.map$cols, lims=c(0,0.106),title="Species contribution to beta diversity", digits=3, prompt=TRUE, lwd=3, outline=TRUE, fsize=0.6, ftype="b")

phy.abd.vasc.3.4.map$cols[]<-grey(seq(1,0,length.out=length(phy.abd.vasc.3.4.map$cols)))
plot(phy.abd.vasc.3.4.map,outline=TRUE,lwd=3, res=10,  ftype="b",sig=2,legend=FALSE, fsize=0.35)
#add.color.bar(420, phy.abd.vasc.3.4.map$cols, lims=c(0,0.106),title="Species contribution to beta diversity", digits=3, prompt=TRUE, lwd=3, outline=TRUE, fsize=0.6, ftype="b")

phy.abd.vasc.4.4.map$cols[]<-grey(seq(1,0,length.out=length(phy.abd.vasc.4.4.map$cols)))
plot(phy.abd.vasc.4.4.map,outline=TRUE,lwd=3, res=10,  ftype="b",sig=2,legend=FALSE, fsize=0.35)

#add.color.bar(420, phy.abd.vasc.4.4.map$cols, lims=c(0,0.106),title="Species contribution to beta diversity", digits=3, prompt=TRUE, lwd=3, outline=TRUE, fsize=0.6, ftype="b")

Five cluster groupings for vascular abundance weighting; phylogenetic beta diversity

#plot all vascular and angiosperm contMaps side-by-side
#dev.new(width=11.8, height=8)
par(mfrow=c(1,5), mar=c(4, 4, 0, 1), mai=c(4, 0, 0, 0))
#Black and white ContMap
phy.abd.vasc.1.5.map$cols[]<-grey(seq(1,0,length.out=length(phy.abd.vasc.1.5.map$cols)))
plot(phy.abd.vasc.1.5.map,outline=TRUE,lwd=3, res=10,  ftype="b",sig=2,legend=FALSE, fsize=0.35)
#add.color.bar(420, phy.abd.vasc.1.5.map$cols, lims=c(0,0.106),title="Species contribution to beta diversity", digits=3, prompt=TRUE, lwd=3, outline=TRUE, fsize=0.6, ftype="b")

#Black and white ContMap for angiosperms only
phy.abd.vasc.2.5.map$cols[]<-grey(seq(1,0,length.out=length(phy.abd.vasc.2.5.map$cols)))
plot(phy.abd.vasc.2.5.map,outline=TRUE,lwd=3, res=10,  ftype="b",sig=2,legend=FALSE, fsize=0.35)
#add.color.bar(420, phy.abd.vasc.2.5.map$cols, lims=c(0,0.106),title="Species contribution to beta diversity", digits=3, prompt=TRUE, lwd=3, outline=TRUE, fsize=0.6, ftype="b")

phy.abd.vasc.3.5.map$cols[]<-grey(seq(1,0,length.out=length(phy.abd.vasc.3.5.map$cols)))
plot(phy.abd.vasc.3.5.map,outline=TRUE,lwd=3, res=10,  ftype="b",sig=2,legend=FALSE, fsize=0.35)
#add.color.bar(420, phy.abd.vasc.3.5.map$cols, lims=c(0,0.106),title="Species contribution to beta diversity", digits=3, prompt=TRUE, lwd=3, outline=TRUE, fsize=0.6, ftype="b")

phy.abd.vasc.4.5.map$cols[]<-grey(seq(1,0,length.out=length(phy.abd.vasc.4.5.map$cols)))
plot(phy.abd.vasc.4.5.map,outline=TRUE,lwd=3, res=10,  ftype="b",sig=2,legend=FALSE, fsize=0.35)
#add.color.bar(420, phy.abd.vasc.4.5.map$cols, lims=c(0,0.106),title="Species contribution to beta diversity", digits=3, prompt=TRUE, lwd=3, outline=TRUE, fsize=0.6, ftype="b")

phy.abd.vasc.5.5.map$cols[]<-grey(seq(1,0,length.out=length(phy.abd.vasc.5.5.map$cols)))
plot(phy.abd.vasc.5.5.map,outline=TRUE,lwd=3, res=10,  ftype="b",sig=2,legend=FALSE, fsize=0.35)

#add.color.bar(420, phy.abd.vasc.5.5.map$cols, lims=c(0,0.106),title="Species contribution to beta diversity", digits=3, prompt=TRUE, lwd=3, outline=TRUE, fsize=0.6, ftype="b")

SCBD of different species across phylogenetic beta diversity clusters (angiosperms)

Three phylogenetic beta diversity clusters (angiosperms)

#plot all angiosperm contMaps side-by-side
#dev.new(width=11.8, height=8)
par(mfrow=c(1,3), mar=c(4, 4, 0, 1), mai=c(4, 0, 0, 0))
#Black and white ContMap
phy.angio.1.3.map$cols[]<-grey(seq(1,0,length.out=length(phy.angio.1.3.map$cols)))
plot(phy.angio.1.3.map,outline=TRUE,lwd=3, res=10,  ftype="b",sig=2,legend=FALSE, fsize=0.35)
#add.color.bar(420, phy.angio.1.3.map$cols, lims=c(0,0.106),title="Species contribution to beta diversity", digits=3, prompt=TRUE, lwd=3, outline=TRUE, fsize=0.6, ftype="b")

#Black and white ContMap for angiosperms only
phy.angio.2.3.map$cols[]<-grey(seq(1,0,length.out=length(phy.angio.2.3.map$cols)))
plot(phy.angio.2.3.map,outline=TRUE,lwd=3, res=10,  ftype="b",sig=2,legend=FALSE, fsize=0.35)
#add.color.bar(420, phy.angio.2.3.map$cols, lims=c(0,0.106),title="Species contribution to beta diversity", digits=3, prompt=TRUE, lwd=3, outline=TRUE, fsize=0.6, ftype="b")

phy.angio.3.3.map$cols[]<-grey(seq(1,0,length.out=length(phy.angio.3.3.map$cols)))
plot(phy.angio.3.3.map,outline=TRUE,lwd=3, res=10,  ftype="b",sig=2,legend=FALSE, fsize=0.35)

#add.color.bar(420, phy.angio.3.3.map$cols, lims=c(0,0.106),title="Species contribution to beta diversity", digits=3, prompt=TRUE, lwd=3, outline=TRUE, fsize=0.6, ftype="b")

Four phylogenetic beta diversity clusters (angiosperms)

#plot all angiosperm contMaps side-by-side
#dev.new(width=11.8, height=8)
par(mfrow=c(1,4), mar=c(4, 4, 0, 1), mai=c(4, 0, 0, 0))
#Black and white ContMap
phy.angio.1.4.map$cols[]<-grey(seq(1,0,length.out=length(phy.angio.1.4.map$cols)))
plot(phy.angio.1.4.map,outline=TRUE,lwd=3, res=10,  ftype="b",sig=2,legend=FALSE, fsize=0.35)
#add.color.bar(420, phy.angio.1.4.map$cols, lims=c(0,0.106),title="Species contribution to beta diversity", digits=3, prompt=TRUE, lwd=3, outline=TRUE, fsize=0.6, ftype="b")

#Black and white ContMap for angiosperms only
phy.angio.2.4.map$cols[]<-grey(seq(1,0,length.out=length(phy.angio.2.4.map$cols)))
plot(phy.angio.2.4.map,outline=TRUE,lwd=3, res=10,  ftype="b",sig=2,legend=FALSE, fsize=0.35)
#add.color.bar(420, phy.angio.2.4.map$cols, lims=c(0,0.106),title="Species contribution to beta diversity", digits=3, prompt=TRUE, lwd=3, outline=TRUE, fsize=0.6, ftype="b")

phy.angio.3.4.map$cols[]<-grey(seq(1,0,length.out=length(phy.angio.3.4.map$cols)))
plot(phy.angio.3.4.map,outline=TRUE,lwd=3, res=10,  ftype="b",sig=2,legend=FALSE, fsize=0.35)
#add.color.bar(420, phy.angio.3.4.map$cols, lims=c(0,0.106),title="Species contribution to beta diversity", digits=3, prompt=TRUE, lwd=3, outline=TRUE, fsize=0.6, ftype="b")

phy.angio.4.4.map$cols[]<-grey(seq(1,0,length.out=length(phy.angio.4.4.map$cols)))
plot(phy.angio.4.4.map,outline=TRUE,lwd=3, res=10,  ftype="b",sig=2,legend=FALSE, fsize=0.35)

#add.color.bar(420, phy.angio.4.4.map$cols, lims=c(0,0.106),title="Species contribution to beta diversity", digits=3, prompt=TRUE, lwd=3, outline=TRUE, fsize=0.6, ftype="b")

Five phylogenetic beta diversity clusters (angiosperms)

#plot all angiosperm contMaps side-by-side
#dev.new(width=11.8, height=8)
par(mfrow=c(1,5), mar=c(4, 4, 0, 1), mai=c(4, 0, 0, 0))
#Black and white ContMap
phy.angio.1.5.map$cols[]<-grey(seq(1,0,length.out=length(phy.angio.1.5.map$cols)))
plot(phy.angio.1.5.map,outline=TRUE,lwd=3, res=10,  ftype="b",sig=2,legend=FALSE, fsize=0.35)
#add.color.bar(420, phy.angio.1.5.map$cols, lims=c(0,0.106),title="Species contribution to beta diversity", digits=3, prompt=TRUE, lwd=3, outline=TRUE, fsize=0.6, ftype="b")

#Black and white ContMap for angiosperms only
phy.angio.2.5.map$cols[]<-grey(seq(1,0,length.out=length(phy.angio.2.5.map$cols)))
plot(phy.angio.2.5.map,outline=TRUE,lwd=3, res=10,  ftype="b",sig=2,legend=FALSE, fsize=0.35)
#add.color.bar(420, phy.angio.2.5.map$cols, lims=c(0,0.106),title="Species contribution to beta diversity", digits=3, prompt=TRUE, lwd=3, outline=TRUE, fsize=0.6, ftype="b")

phy.angio.3.5.map$cols[]<-grey(seq(1,0,length.out=length(phy.angio.3.5.map$cols)))
plot(phy.angio.3.5.map,outline=TRUE,lwd=3, res=10,  ftype="b",sig=2,legend=FALSE, fsize=0.35)
#add.color.bar(420, phy.angio.3.5.map$cols, lims=c(0,0.106),title="Species contribution to beta diversity", digits=3, prompt=TRUE, lwd=3, outline=TRUE, fsize=0.6, ftype="b")

phy.angio.4.5.map$cols[]<-grey(seq(1,0,length.out=length(phy.angio.4.5.map$cols)))
plot(phy.angio.4.5.map,outline=TRUE,lwd=3, res=10,  ftype="b",sig=2,legend=FALSE, fsize=0.35)
#add.color.bar(420, phy.angio.4.5.map$cols, lims=c(0,0.106),title="Species contribution to beta diversity", digits=3, prompt=TRUE, lwd=3, outline=TRUE, fsize=0.6, ftype="b")

phy.angio.5.5.map$cols[]<-grey(seq(1,0,length.out=length(phy.angio.5.5.map$cols)))
plot(phy.angio.5.5.map,outline=TRUE,lwd=3, res=10,  ftype="b",sig=2,legend=FALSE, fsize=0.35)

#add.color.bar(420, phy.angio.5.5.map$cols, lims=c(0,0.106),title="Species contribution to beta diversity", digits=3, prompt=TRUE, lwd=3, outline=TRUE, fsize=0.6, ftype="b")

Weighted phylogenetic beta diversity clusters for angiosperms

Three weighted phylogenetic beta diversity clusters (angiosperms)

#plot all angiosperm contMaps side-by-side
#dev.new(width=11.8, height=8)
par(mfrow=c(1,3), mar=c(4, 4, 0, 1), mai=c(4, 0, 0, 0))
#Black and white ContMap
phy.abd.angio.1.3.map$cols[]<-grey(seq(1,0,length.out=length(phy.abd.angio.1.3.map$cols)))
plot(phy.abd.angio.1.3.map,outline=TRUE,lwd=3, res=10,  ftype="b",sig=2,legend=FALSE, fsize=0.35)
##add.color.bar(420, phy.abd.angio.1.3.map$cols, lims=c(0,0.106),title="Species contribution to beta diversity", #digits=3, prompt=TRUE, lwd=3, outline=TRUE, fsize=0.6, ftype="b")

#Black and white ContMap for angiosperms only
phy.abd.angio.2.3.map$cols[]<-grey(seq(1,0,length.out=length(phy.abd.angio.2.3.map$cols)))
plot(phy.abd.angio.2.3.map,outline=TRUE,lwd=3, res=10,  ftype="b",sig=2,legend=FALSE, fsize=0.35)
##add.color.bar(420, phy.abd.angio.2.3.map$cols, lims=c(0,0.106),title="Species contribution to beta diversity", #digits=3, prompt=TRUE, lwd=3, outline=TRUE, fsize=0.6, ftype="b")

phy.abd.angio.3.3.map$cols[]<-grey(seq(1,0,length.out=length(phy.abd.angio.3.3.map$cols)))
plot(phy.abd.angio.3.3.map,outline=TRUE,lwd=3, res=10,  ftype="b",sig=2,legend=FALSE, fsize=0.35)

##add.color.bar(420, phy.abd.angio.3.3.map$cols, lims=c(0,0.106),title="Species contribution to beta diversity", #digits=3, prompt=TRUE, lwd=3, outline=TRUE, fsize=0.6, ftype="b")

Four weighted phylogenetic beta diversity clusters (angiosperms)

#plot all angiosperm contMaps side-by-side
#dev.new(width=11.8, height=8)
par(mfrow=c(1,4), mar=c(4, 4, 0, 1), mai=c(4, 0, 0, 0))
#Black and white ContMap
phy.abd.angio.1.4.map$cols[]<-grey(seq(1,0,length.out=length(phy.abd.angio.1.4.map$cols)))
plot(phy.abd.angio.1.4.map,outline=TRUE,lwd=3, res=10,  ftype="b",sig=2,legend=FALSE, fsize=0.35)
##add.color.bar(420, phy.abd.angio.1.4.map$cols, lims=c(0,0.106),title="Species contribution to beta diversity", #digits=3, prompt=TRUE, lwd=3, outline=TRUE, fsize=0.6, ftype="b")

#Black and white ContMap for angiosperms only
phy.abd.angio.2.4.map$cols[]<-grey(seq(1,0,length.out=length(phy.abd.angio.2.4.map$cols)))
plot(phy.abd.angio.2.4.map,outline=TRUE,lwd=3, res=10,  ftype="b",sig=2,legend=FALSE, fsize=0.35)
##add.color.bar(420, phy.abd.angio.2.4.map$cols, lims=c(0,0.106),title="Species contribution to beta diversity", #digits=3, prompt=TRUE, lwd=3, outline=TRUE, fsize=0.6, ftype="b")

phy.abd.angio.3.4.map$cols[]<-grey(seq(1,0,length.out=length(phy.abd.angio.3.4.map$cols)))
plot(phy.abd.angio.3.4.map,outline=TRUE,lwd=3, res=10,  ftype="b",sig=2,legend=FALSE, fsize=0.35)
##add.color.bar(420, phy.abd.angio.3.4.map$cols, lims=c(0,0.106),title="Species contribution to beta diversity", #digits=3, prompt=TRUE, lwd=3, outline=TRUE, fsize=0.6, ftype="b")

phy.abd.angio.4.4.map$cols[]<-grey(seq(1,0,length.out=length(phy.abd.angio.4.4.map$cols)))
plot(phy.abd.angio.4.4.map,outline=TRUE,lwd=3, res=10,  ftype="b",sig=2,legend=FALSE, fsize=0.35)

##add.color.bar(420, phy.abd.angio.4.4.map$cols, lims=c(0,0.106),title="Species contribution to beta diversity", #digits=3, prompt=TRUE, lwd=3, outline=TRUE, fsize=0.6, ftype="b")

Five weighted phylogenetic beta diversity clusters (angiosperms)

#plot all angiosperm contMaps side-by-side
#dev.new(width=11.8, height=8)
par(mfrow=c(1,5), mar=c(4, 4, 0, 1), mai=c(4, 0, 0, 0))
#Black and white ContMap
phy.abd.angio.1.5.map$cols[]<-grey(seq(1,0,length.out=length(phy.abd.angio.1.5.map$cols)))
plot(phy.abd.angio.1.5.map,outline=TRUE,lwd=3, res=10,  ftype="b",sig=2,legend=FALSE, fsize=0.35)
##add.color.bar(420, phy.abd.angio.1.5.map$cols, lims=c(0,0.106),title="Species contribution to beta diversity", #digits=3, prompt=TRUE, lwd=3, outline=TRUE, fsize=0.6, ftype="b")

#Black and white ContMap for angiosperms only
phy.abd.angio.2.5.map$cols[]<-grey(seq(1,0,length.out=length(phy.abd.angio.2.5.map$cols)))
plot(phy.abd.angio.2.5.map,outline=TRUE,lwd=3, res=10,  ftype="b",sig=2,legend=FALSE, fsize=0.35)
##add.color.bar(420, phy.abd.angio.2.5.map$cols, lims=c(0,0.106),title="Species contribution to beta diversity", #digits=3, prompt=TRUE, lwd=3, outline=TRUE, fsize=0.6, ftype="b")

phy.abd.angio.3.5.map$cols[]<-grey(seq(1,0,length.out=length(phy.abd.angio.3.5.map$cols)))
plot(phy.abd.angio.3.5.map,outline=TRUE,lwd=3, res=10,  ftype="b",sig=2,legend=FALSE, fsize=0.35)
##add.color.bar(420, phy.abd.angio.3.5.map$cols, lims=c(0,0.106),title="Species contribution to beta diversity", #digits=3, prompt=TRUE, lwd=3, outline=TRUE, fsize=0.6, ftype="b")

phy.abd.angio.4.5.map$cols[]<-grey(seq(1,0,length.out=length(phy.abd.angio.4.5.map$cols)))
plot(phy.abd.angio.4.5.map,outline=TRUE,lwd=3, res=10,  ftype="b",sig=2,legend=FALSE, fsize=0.35)
##add.color.bar(420, phy.abd.angio.4.5.map$cols, lims=c(0,0.106),title="Species contribution to beta diversity", #digits=3, prompt=TRUE, lwd=3, outline=TRUE, fsize=0.6, ftype="b")

phy.abd.angio.5.5.map$cols[]<-grey(seq(1,0,length.out=length(phy.abd.angio.5.5.map$cols)))
plot(phy.abd.angio.5.5.map,outline=TRUE,lwd=3, res=10,  ftype="b",sig=2,legend=FALSE, fsize=0.35)

##add.color.bar(420, phy.abd.angio.5.5.map$cols, lims=c(0,0.106),title="Species contribution to beta diversity", #digits=3, prompt=TRUE, lwd=3, outline=TRUE, fsize=0.6, ftype="b")

Blomberg’s K statistic for the different methods

# K-values for three groupings
K.3<-round(rbind(env.clust.K.3,ph.vasc.K.3, ph.abd.vasc.K.3,ph.angio.K.3,ph.abd.angio.K.3),digits=3)
K.4<-round(rbind(env.clust.K.4,ph.vasc.K.4, ph.abd.vasc.K.4,ph.angio.K.4,ph.abd.angio.K.4),digits=3)
K.5<-round(rbind(env.clust.K.5,ph.vasc.K.5, ph.abd.vasc.K.5,ph.angio.K.5,ph.abd.angio.K.5),digits=3)

K.3
##                   Group 1 Group 2 Group 3
## Env.dist            0.003   0.002   0.011
## Phy.div vasc        0.019   0.002   0.003
## Phy.div.abd vasc    0.068   0.003   0.003
## Phy.div angio       0.058   0.034   0.004
## Phy.div.abd angio   0.005   0.058   0.004
K.4
##                   Group 1 Group 2 Group 3 Group 4
## Env.dist            0.003   0.012   0.002   0.003
## Phy.div vasc        0.006   0.002   0.020   0.003
## Phy.div.abd vasc    0.005   0.068   0.002   0.024
## Phy.div angio       0.039   0.035   0.004   0.057
## Phy.div.abd angio   0.066   0.007   0.016   0.003
K.5
##                   Group 1 Group 2 Group 3 Group 4 Group 5
## Env.dist            0.006   0.005   0.003   0.012   0.002
## Phy.div vasc        0.020   0.003   0.002   0.002   0.018
## Phy.div.abd vasc    0.002   0.002   0.024   0.012   0.081
## Phy.div angio       0.004   0.004   0.004   0.043   0.019
## Phy.div.abd angio   0.020   0.067   0.016   0.003   0.004