Skip to content

Commit

Permalink
Delete code that plots the chord plots for species with trait informa…
Browse files Browse the repository at this point in the history
…tion and growth information
  • Loading branch information
Susy Echeverria Londoño committed Mar 6, 2018
1 parent 00e31e6 commit 954b154
Showing 1 changed file with 0 additions and 99 deletions.
99 changes: 0 additions & 99 deletions plot_SpeciesComposition.R
Original file line number Diff line number Diff line change
Expand Up @@ -113,105 +113,6 @@ chordDiagram(spSimilarity_1, grid.col =col,symmetric = TRUE,
dev.off()


# Plot with species with traits -------------------------------------------
trait_BIEN<-read.csv("./data/processed/BIEN_trait_GrowthForm.csv")
trait_BIEN$scrubbed_species_binomial<-gsub(" ","_",trait_BIEN$scrubbed_species_binomial)

spPresence_sub<-spPresence[spPresence$Species%in%trait_BIEN$scrubbed_species_binomial,]
spPresence_sub<-na.omit(spPresence_sub)


# Species list
biome_richness_sub<-foreach(i=1:length(biome_poly)) %do% {

cells_tmp<-unlist(cellFromPolygon(r_Total_Rich,biome_poly[[i]]))
sp_list_tmp<-unique(spPresence_sub$Species[spPresence_sub$cells%in%cells_tmp])

}
names(biome_richness_sub)<-names(biome_poly)


## Create similarity matrix
## Create a loop to calculate the similarity (number of species shared among biomes)
spSimilarity_sub<-foreach(i=1:length(biome_richness_sub), .combine='cbind') %:%
foreach(j=1:length(biome_richness_sub), .combine='c') %do% {
length(intersect(biome_richness_sub[[i]],biome_richness_sub[[j]]))
}

colnames(spSimilarity_sub)<-names(biome_richness_sub)
rownames(spSimilarity_sub)<-names(biome_richness_sub)


col=c(wes_palette("Darjeeling",6,type="continuous"),
wes_palette("Cavalcanti",6,type="continuous"))

spSimilarity_sub1<-spSimilarity_sub
diag(spSimilarity_sub1)<-0

colnames(spSimilarity_sub1)<-c("moist","tropical.mixed",
"savanna","grasslands",
"dry","xeric","MED",
"TEMP","CONI","PRA","TA","TU")

rownames(spSimilarity_sub1)<-colnames(spSimilarity_sub1)


pdf("./figs/OnlyTrait_similarity_biomes.pdf")
chordDiagram(spSimilarity_sub1, grid.col =col,symmetric = TRUE,link.sort = TRUE,
column.col = col)
dev.off()



# Plot species with growth form -------------------------------------------
Growth_form<-read.table("data/base/GrowthForm_Final.txt", header = TRUE)
Growth_form$SPECIES_STD<-gsub(" ","_",Growth_form$SPECIES_STD)

spPresence_sub<-spPresence[spPresence$Species%in%Growth_form$SPECIES_STD,]
spPresence_sub<-na.omit(spPresence_sub)


# Species list
biome_richness_sub<-foreach(i=1:length(biome_poly)) %do% {

cells_tmp<-unlist(cellFromPolygon(r_Total_Rich,biome_poly[[i]]))
sp_list_tmp<-unique(spPresence_sub$Species[spPresence_sub$cells%in%cells_tmp])

}
names(biome_richness_sub)<-names(biome_poly)


## Create similarity matrix
## Create a loop to calculate the similarity (number of species shared among biomes)
spSimilarity_sub<-foreach(i=1:length(biome_richness_sub), .combine='cbind') %:%
foreach(j=1:length(biome_richness_sub), .combine='c') %do% {
length(intersect(biome_richness_sub[[i]],biome_richness_sub[[j]]))
}

colnames(spSimilarity_sub)<-names(biome_richness_sub)
rownames(spSimilarity_sub)<-names(biome_richness_sub)


col=c(wes_palette("Darjeeling",6,type="continuous"),
wes_palette("Cavalcanti",6,type="continuous"))

spSimilarity_sub1<-spSimilarity_sub
diag(spSimilarity_sub1)<-0

colnames(spSimilarity_sub1)<-c("moist","tropical.mixed",
"savanna","grasslands",
"dry","xeric","MED",
"TEMP","CONI","PRA","TA","TU")

rownames(spSimilarity_sub1)<-colnames(spSimilarity_sub1)


pdf("./figs/OnlyGrowth_similarity_biomes.pdf")
chordDiagram(spSimilarity_sub1, grid.col =col,symmetric = TRUE,link.sort = TRUE,
column.col = col)
dev.off()





0 comments on commit 954b154

Please sign in to comment.