# NOT RUN {
#### Artificial dataset:
SyntheticTrial <- SyntheticData(SpeciesNum = 21, CommunityNum = 3,
SpCo = NULL ,Length = 500,
Parameters = list(a=rep(60, 3),
b=c(0,250,500),
c=rep(0.015,3)),
pal = c("#008585", "#FBF2C4", "#C7522B"))
## Analyses:
EcoFinder <- EcotoneFinder(data = SyntheticTrial[,-1],
dist = SyntheticTrial$Distance,
method = "all", groups = 3,
standardize = "hellinger", diversity = "all")
## Slope calculation:
EcoSlope <- Slope(EcoFinder, method = "all", axis.number = 2,
diversity = "all")
## Plots:
# }
# NOT RUN {
require(ggplot2)
require(colorspace)
# Species Distributions and Fuzzy clusters:
Plot <- ggEcotone(EcoFinder, slope = EcoSlope, plot.data = TRUE,
method = c("cmeans", "fanny"),
col = c("#D33F6A", "#E99A2C", "#E2E6BD"),
facet = list(c("data"), c("cmeans", "fanny")),
title = "Species distribution and fuzzy clusters",
xlab = "Gradient", ylab = "Membership grades") +
theme(plot.title = element_text(hjust = 0.5, face="bold")) +
theme_bw()
Plot
# Fuzzy clusters & derivatives:
Plot <- ggEcotone(EcoFinder, slope = EcoSlope, plot.data = FALSE,
method = c("cmeans", "cmeans_slope"),
col = c("#D33F6A", "#E99A2C", "#E2E6BD"),
facet = c("cmeans", "cmeans_slope"),
title = "fuzzy clusters and derivatives",
xlab = "Gradient", ylab = "Membership grades") +
theme(plot.title = element_text(hjust = 0.5, face="bold")) +
theme_bw()
Plot
# Multiplot layout:
GG1 <- ggEcotone(EcoFinder, slope = EcoSlope, plot.data = TRUE,
method = c("none"), col = heat_hcl(21), facet = NULL,
title = "Species distributions", xlab = NULL,
ylab = "Abundances") +
theme(plot.title = element_text(hjust = 0.5, face="bold")) +
theme_bw()
GG2 <- ggEcotone(EcoFinder, slope = EcoSlope, plot.data = FALSE,
method = c("cmeans"), col = c("#023FA5", "#BEC1D4", "#D6BCC0"),
facet = NULL, title = "Fuzzy clusters", xlab = NULL,
ylab = "Membership grades") +
theme(plot.title = element_text(hjust = 0.5, face="bold")) +
theme_bw()
GG3 <- ggEcotone(EcoFinder, slope = EcoSlope, plot.data = FALSE,
method = c("diversity"),
col = c("#26A63A", "#B4B61A"), facet = NULL,
diversity=c("SpeciesRichness", "ExpShannon"),
title = "diversity indices", xlab = "Gradient",
ylab = "Index scores") +
theme(plot.title = element_text(hjust = 0.5, face="bold")) +
theme_bw()
require(Rmisc)
Rmisc::multiplot(GG1,GG2,GG3)
# }
# NOT RUN {
# }
Run the code above in your browser using DataLab