Commit 27f2e165 authored by kunstler's avatar kunstler
Browse files

finish changes on figs

parent a037c86f
......@@ -481,7 +481,10 @@ theme_simple <- function(){
legend.title=element_blank(),
strip.background = element_blank(),
legend.key = element_blank(),
legend.position=c(.3,.07)
legend.position=c(.1,.15),
strip.text = element_text(size=14),
axis.title.x = element_text(size=14),
axis.title.y = element_text(size=14)
) +
#draws x and y axis line
theme(axis.line = element_line(color = 'black'))
......@@ -495,7 +498,7 @@ plot.growth.ba <- function(traits, model, type, dir.root, list.res.all,
xlab_p = expression(paste("Basal area ",
(m^{2} ~~ ha^{-1}))),
ylab_p = expression(paste("Basal area growth",
(m^{2} ~~ yr^{-1}))),
(cm^{2} ~~ yr^{-1}))),
labels.leg = c('Trait high', 'Trait low')){
require(RColorBrewer)
......@@ -509,7 +512,7 @@ ggplot(DF, aes_string(x = var.x, y = var.y, colour = var.quant)) +
geom_ribbon(aes_string(ymin=var.l, ymax=var.h,
fill = var.quant, linetype=NA, show_guide=FALSE), alpha=0.2) +
scale_fill_manual(values = cols, labels = labels.leg) +
facet_wrap( ~ traits, ncol=1) + theme_simple() + guides(colour=FALSE)+
facet_wrap( ~ traits, nrow=1) + theme_simple() + guides(colour=FALSE)+
ylab(ylab_p)+xlab(xlab_p)
}
......@@ -711,22 +714,38 @@ return(list(fixed.biomes = param.biomes,
fixed.biomes.std = std.biomes))
}
biomes.factor.selected <- function(idx.select = 4:9){
biomes.factor.selected <- function(idx.select = c(4:7, 9)){
all.fact <- factor(c("Subtropical desert", "Temperate grassland desert", "Tundra",
"Boreal forest", "Temperate forest", "Temperate rain forest",
"Tropical forest savanna", "Tropical rain forest", "Woodland shrubland"))
levels.name <- levels(all.fact)
levels.name[levels.name == 'Tundra'] <- 'Boreal forest'
levels.name[levels.name == 'Subtropical desert'] <- 'Temperate grassland desert'
levels.name[levels.name == "Tropical rain forest"] <- "Tropical forest savanna"
levels(all.fact) <- levels.name
return(all.fact[idx.select])
}
fun.biomes.names <- function(){
c("Subtropical desert" = "desert",
"Temperate grassland desert" = "desert",
"Tundra" = "tundra",
"Boreal forest" = "taiga",
"Temperate forest" = "temperate forest",
"Temperate rain forest" = "temperate rainforest",
"Tropical forest savanna" = "tropical forest",
"Tropical rain forest" = "tropical forest",
"Woodland shrubland" = "woodland/shrubland")
}
plot.param.biomes.fixed <- function(list.res,
model,
biomes.names = c("Taiga",
"Temperate forest",
"Temperate rainforest",
"Tropical seasonal forest",
"Tropical rainforest",
"Woodland/shrubland"),
biomes.names = fun.biomes.names(),
biomes = biomes.factor.selected(),
traits = c('Wood.density', 'SLA', 'Max.height'),
traits.names = c(Wood.density= 'Wood density',
......@@ -747,9 +766,9 @@ plot.param.biomes.fixed <- function(list.res,
...){
col.vec[2] <- col.vec[1]
biomes.c <- as.character(biomes)
big.m <- 3
small.m <- 0.42
legend.m <- 2
big.m <- 3.1
small.m <- 0
legend.m <- 1.9
wid <- c(big.m ,0, small.m) +
rep((14-big.m-small.m-legend.m)/3, each= 3)
m <- matrix(c(1:4), 1, 4)
......@@ -792,7 +811,7 @@ for (i in traits){
side = 2,
labels = param.names,
cols.vec = col.names[param.vec],
cex.axis = 2)
cex.axis = 2.1)
}
fun.plot.error.bar.horiz(param.mean,
seq.jitter+n.vars,
......@@ -800,10 +819,10 @@ for (i in traits){
}
}
par(mar=c(0, 0, 0, 0))
plot(1,1,type="n", axes=F, xlab="", ylab="")
legend("center",legend = biomes.names, col = col.vec[biomes.c],
plot(1,1,type="n", axes=FALSE, xlab="", ylab="")
legend(0.6 , 1.1, legend = biomes.names[biomes.c], col = col.vec[biomes.c],
pch = pch.vec[biomes.c], lty =1, lwd = 1.5,
bty = 'n', cex = 1.5)
bty = 'n', cex = 1.55)
}
......
......@@ -26,7 +26,7 @@ run.model.for.set.one.trait <- function(model.file, fun.model, trait,
# Run lmer() (in package lme4) for one ecoregion, one trait, one model
#=====================================================================
path.model <- "R/analysis/model.lmer/"
path.model <- "R/analysis/model.lmer"
model.files.lmer.Tf.1 <- file.path(path.model,
c("model.lmer.LOGLIN.ER.AD.Tf.fixed.biomes.species.R",
"model.lmer.LOGLIN.ER.AD.Tf.r.ecocode.fixed.biomes.species.R",
......@@ -216,6 +216,7 @@ levels.name[levels.name == 'Tundra'] <- 'Boreal forest'
levels.name[levels.name == 'Subtropical desert'] <- 'Temperate grassland desert'
levels.name[levels.name == "Tropical rain forest"] <- "Tropical forest savanna"
levels(data$biomes) <- levels.name
print('biomes merged')
return(data)
}
......
......@@ -128,14 +128,12 @@ fixed effect to analyse the difference between biomes.
**Acknowledgements**
We are thankful that people whose long term commitment allowed the established and
maintained the forest plots and their associated databases, granted us access to forest inventory data and long term forest plots of NVS, Japan, Spain, France, Switzerland, Sweden, US, Canada (for the following provinces: Québec, ...), CTFS plots (BCI, Fushan and Luquillo) and Cirad permanent plots (Paracou, M'Baiki). GK
maintained the forest plots and their associated databases, granted us access to forest inventory data and long term forest plots of NVS, Japan, Spain, France, Switzerland, Sweden, US, Canada (for the following provinces: Québec, **TODO**), CTFS plots (BCI, Fushan and Luquillo) and Cirad permanent plots (Paracou, M'Baiki). GK
was supported by a Marie Curie International Outgoing Fellowship
within the 7th European Community Framework Program (Demo-
traits project, no. 299340).
within the 7th European Community Framework Program (Demo-traits project, no. 299340).
**Author contributions**
G.K. conceived the study with feedback from M.W and D.F. G. K., M. W and ... wrote the manuscript. G.K. devised the main
analytical approach, wrote the computer code and performed analyses.
G.K. conceived the study with feedback from M.W and D.F. G. K., M. W, D. F. and ... wrote the manuscript. G.K. devised the main analytical approach, wrote the computer code and performed analyses. G.K. and F.H. processed the data. XXX collected and processed the raw data.
**Author information**
......@@ -146,47 +144,22 @@ analytical approach, wrote the computer code and performed analyses.
![**Assessing competitive interactions at global scale.** **a,** Precipitation-temperature space occupied by the natural forest communities studied (NFI data : national forest Inventories, LPP data : large permanent plots) . Biomes follow the definition of Whittaker [@ricklefs_economy_2001]:
1, tundra; 2, taiga; 3, woodland/shrubland; 4, temperate forest; 5,
temperate rainforest; 6, desert; 7, tropical seasonal forest; 8,
tropical rainforest. **b,** Sampled patches vary in the density of
competitors from species $c$ around individuals from a focal species
$f$. For each tree we record the stem diameter $D_i$ across multiple
censuses, and link this with records for the traits of the focal and
competitor species, $t_f$ and $t_c$ respectively. **c,** We use a
neighbourhood modelling framework to model the effects of the traits
and size of the focal tree, and the total basal area ($B_c$) and
traits of competitor species on growth of the focal tree. These
effects can be broken down into those influencing maximum growth
rate (red) and those influencing reduction in growth per unit basal area of competitor (blue), $\alpha_{c,f}$. Trait value of focal tree ($t_f$) can influences the tree growth without competition (maximum growth, $m_1$). The trait value of the focal tree can influences its tolerance to competition ($t_f \, \alpha_r$) and the trait values of the competitors can influence their competitive impact ($t_c \, \alpha_i$). Finally, the trait similarity between the focal tree and its competitors can influences competitive interactions ($\alpha_s \, \vert t_c-t_f \vert$) (see extended methods). The parameters $m_1, \gamma, \alpha_0, \alpha_i, \alpha_r$ and $\alpha_s$ are fitted from data. \label{ilustr2}](image/fig1e.pdf)
![**Assessing competitive interactions at global scale.** **a,** Precipitation-temperature space occupied by the natural forest communities studied (NFI data : national forest Inventories, LPP data : large permanent plots) . Biomes follow the definition of Whittaker [@ricklefs_economy_2001]: 1, tundra; 2, taiga; 3, woodland/shrubland; 4, temperate forest; 5, temperate rainforest; 6, desert; 7, tropical seasonal forest; 8, tropical rainforest. **b,** Sampled patches vary in the density of competitors from species $c$ around individuals from a focal species $f$. For each tree we record the stem diameter $D_i$ across multiple censuses, and link this with records for the traits of the focal and competitor species, $t_f$ and $t_c$ respectively. **c,** We use a neighbourhood modelling framework to model the effects of the traits and size of the focal tree, and the total basal area ($B_c$) and traits of competitor species on growth of the focal tree. These effects can be broken down into those influencing maximum growth rate (red) and those influencing reduction in growth per unit basal area of competitor (blue), $\alpha_{c,f}$. Trait value of focal tree ($t_f$) can influences the tree growth without competition (maximum growth, $m_1$). The trait value of the focal tree can influences its tolerance to competition ($t_f \, \alpha_r$) and the trait values of the competitors can influence their competitive impact ($t_c \, \alpha_i$). Finally, the trait similarity between the focal tree and its competitors can influences competitive interactions ($\alpha_s \, \vert t_c-t_f \vert$) (see extended methods). The parameters $m_1, \gamma, \alpha_0, \alpha_i, \alpha_r$ and $\alpha_s$ are fitted from data. \label{ilustr2}](image/fig1e.pdf)
\newpage
![**Traits effects on maximum growth and competition.** Standardized regression coefficients of the growth models in function of the trait of the focal tree and its competitors fitted separately for each traits (Wood density, *SLA*, and maximum height). The parameters estimate represents the traits effect explained in the Fig 1c.: the direct trait effect on maximum growth of the focal tree, the competition trait independent, the trait of the competitors effect on their competitive impact, the trait of the focal tree effect on its competitive response, and trait similarity between the focal tree and its competitors effect on competition. The points represent the mean estimate and the line the 95\% confidence interval. \label{res1}](../../figs/figressp1b.pdf)
![**Traits effects and traits independent effects on maximum growth and competition.** Standardized regression coefficients of the growth models in function of the trait of the focal tree and its competitors fitted separately for each traits (Wood density, Specific leaf area, and Maximum height). The parameters estimate represents the effect explained in the Fig 1c.: the size effect effect on maximum growth, the direct trait effect on maximum growth of the focal tree, the competition trait independent, the trait of the competitors effect on their competitive impact, the trait of the focal tree effect on its competitive response, and trait similarity between the focal tree and its competitors effect on competition. The points represent the mean estimate and the line the 95\% confidence interval. \label{res1}](../../figs/figres1.pdf)
\newpage
![**Variation of traits effects on maximum growth and competition between biomes.** Standardized regression coefficients of the growth models in function of the trait of the focal tree and its competitors fitted separately for each traits as in Fig. 2, but with a different estimates for each biomes (see Fig 1a. for the definitions of the biomes). **NEED TO UPDATE WITH FIGURE WITH FIXED BIOMES EFFECT**. \label{res2}](../../figs/figresspBLUP1.pdf)
![**Variation of traits effects on maximum growth and competition between biomes.** Standardized regression coefficients of the growth models in function of the trait of the focal tree and its competitors fitted separately for each traits as in Fig. 2, but with a different estimates for each biomes (see Fig 1a. for the definitions of the biomes). \label{res2}](../../figs/figres2.pdf)
\newpage
![Trade off between growth without competition and growth with competition underpinned by Maximum height, SLA (specific leaf area), and wood density (**I need to update the name of the traits**). The growth of a focal tree with low or high trait value (respectively 5 and 95\% quantile) in function of the local basal area of competitors with trait value resulting in a high competitive impact. The shaded area represents the 95% confidence interval of the prediction. \label{res3}](../../figs/figres3.pdf)
<!-- # POINTS TO DISCUSS WITH DANIEL -->
<!-- 1. Fig 1 include size effect or not. Size effect is not interesting -->
<!-- here. -->
<!-- 2. set on biomes ? -->
<!-- 3. Split param between trait and not trait? The comparison of trait -->
<!-- effect and mean comp is interesting. -->
<!-- 4. Biomes effect ..... -->
![**Trade off between growth without competition and growth with competition underpinned by Maximum height, Specific leaf area, and wood density**. The growth of a focal tree with low or high trait value (respectively 5 and 95\% quantile) in function of the local basal area of competitors with trait value resulting in a high competitive impact. The shaded area represents the 95% confidence interval of the prediction. \label{res3}](../../figs/figres3.pdf)
......
......@@ -102,8 +102,8 @@ plot.param(list.all.results.set , data.type = "simple",
xlim = c(-0.45, 0.45))
dev.off()
pdf('figs/figres1b.pdf', height = 7, width = 14)
plot.param(list.all.results.set , data.type = "simple",
pdf('figs/figres1biomes.pdf', height = 7, width = 14)
plot.param(list.all.results.biomes.id.set , data.type = "simple",
model = 'lmer.LOGLIN.ER.AD.Tf.r.set.biomes.species',
traits = c('Wood.density', 'SLA', 'Max.height'),
param.vec = c("sumTnTfBn.abs", "sumTnBn", "sumTfBn",
......@@ -125,7 +125,7 @@ plot.param(list.all.results.set , data.type = "simple",
dev.off()
pdf('figs/figresBLUP1.pdf', height = 7, width = 14)
pdf('figs/figresBLUP1biomes.pdf', height = 7, width = 14)
plot.param.BLUP(list.all.results.biomes.id.set , data.type = "simple",
model = 'lmer.LOGLIN.ER.AD.Tf.r.set.biomes.species',
traits = c('Wood.density', 'SLA', 'Max.height'),
......@@ -148,76 +148,27 @@ plot.param.BLUP(list.all.results.biomes.id.set , data.type = "simple",
dev.off()
pdf('figs/figressp1.pdf', height = 7, width = 14)
plot.param(list.all.results.species.id.set , data.type = "simple",
model = 'lmer.LOGLIN.ER.AD.Tf.r.set.species',
traits = c('Wood.density', 'SLA', 'Max.height'),
param.vec = c("sumTnTfBn.abs", "sumTnBn", "sumTfBn",
"sumBn", "Tf"),
param.names = c(expression(paste('Compet trait simil ',
(alpha[l] %*% abs(t[n] - t[f])))),
expression(paste('Compet response ',
(alpha[r] %*% t[f]))),
expression(paste('Compet impact ',
(alpha[i] %*% t[c]))),
expression(paste('Compet trait indep ',
(alpha[0]))),
expression(paste("Direct trait effect ",
(m[1] %*% t[f])))) ,
col.vec = fun.col.pch.biomes()$col.vec,
pch.vec = fun.col.pch.biomes()$pch.vec,
names.bio = names.biomes ,
xlim = c(-0.5, 0.3))
dev.off()
pdf('figs/figressp1b.pdf', height = 7, width = 14)
plot.param(list.all.results.species.id.set , data.type = "simple",
model = 'lmer.LOGLIN.ER.AD.Tf.r.set.biomes.species',
traits = c('Wood.density', 'SLA', 'Max.height'),
param.vec = c("sumTnTfBn.abs", "sumTnBn", "sumTfBn",
"sumBn", "Tf"),
param.names = c(expression(paste('Compet trait simil ',
(alpha[l] %*% abs(t[n] - t[f])))),
expression(paste('Compet response ',
(alpha[r] %*% t[f]))),
expression(paste('Compet impact ',
(alpha[i] %*% t[c]))),
expression(paste('Compet trait indep ',
(alpha[0]))),
expression(paste("Direct trait effect ",
(m[1] %*% t[f])))) ,
col.vec = fun.col.pch.biomes()$col.vec,
pch.vec = fun.col.pch.biomes()$pch.vec,
names.bio = names.biomes ,
xlim = c(-0.65, 0.3))
dev.off()
pdf('figs/figresspBLUP1.pdf', height = 7, width = 14)
plot.param.BLUP(list.all.results.species.id.set , data.type = "simple",
model = 'lmer.LOGLIN.ER.AD.Tf.r.set.biomes.species',
traits = c('Wood.density', 'SLA', 'Max.height'),
pdf('figs/figres2.pdf', height = 7, width = 16)
plot.param.biomes.fixed(list.all.results.set, data.type = 'simple',
model = 'lmer.LOGLIN.ER.AD.Tf.r.set.fixed.biomes.species',
param.vec = c("sumTnTfBn.abs", "sumTnBn", "sumTfBn",
"sumBn", "Tf"),
"Tf"),
param.names = c(expression(paste('Compet trait simil ',
(alpha[l] %*% abs(t[n] - t[f])))),
expression(paste('Compet response ',
(alpha[r] %*% t[f]))),
expression(paste('Compet impact ',
(alpha[i] %*% t[c]))),
expression(paste('Compet trait indep ',
(alpha[0]))),
expression(paste("Direct trait effect ",
(m[1] %*% t[f])))) ,
col.vec = fun.col.pch.biomes()$col.vec,
pch.vec = fun.col.pch.biomes()$pch.vec,
names.bio = names.biomes ,
xlim = c(-0.65, 0.3), biomes.TF = TRUE)
param.print = 1:4,
col.vec = fun.col.pch.biomes()$col.vec,
pch.vec = fun.col.pch.biomes()$pch.vec,
xlim = c(-0.27, 0.298))
dev.off()
pdf('figs/figres2.pdf', height = 7, width = 16)
plot.param.biomes.fixed(list.all.results.set, data.type = 'simple',
pdf('figs/figres2biomes.pdf', height = 7, width = 16)
plot.param.biomes.fixed(list.all.results.biomes.id.set, data.type = 'simple',
model = 'lmer.LOGLIN.ER.AD.Tf.r.set.fixed.biomes.species',
param.vec = c("sumTnTfBn.abs", "sumTnBn", "sumTfBn",
"Tf"),
......@@ -232,15 +183,13 @@ plot.param.biomes.fixed(list.all.results.set, data.type = 'simple',
param.print = 1:4,
col.vec = fun.col.pch.biomes()$col.vec,
pch.vec = fun.col.pch.biomes()$pch.vec,
xlim = c(-0.35, 0.29))
xlim = c(-0.27, 0.298))
dev.off()
# logD
### PLOT TRADE OFF
pdf('figs/figres3.pdf', width = 3.5, height = 9)
pdf('figs/figres3.pdf', width = 9, height = 4)
plot.growth.ba(traits = c('Wood.density', 'SLA', 'Max.height'),
model = 'lmer.LOGLIN.ER.AD.Tf.r.set.species',
type = 'Tabs', data.type = 'simple',
......
......@@ -9,6 +9,13 @@ source("R/utils/plot.R")
## format data
require(lme4)
run.multiple.model.for.set.one.trait(model.files.lmer.Tf.3[3],
run.lmer,'SLA', sample.size = 2000,
var.sample = 'biomes', merge.biomes.TF = TRUE)
library(doParallel)
cl <- makeCluster(9)
registerDoParallel(cl)
......
......@@ -18,7 +18,7 @@ data.all <- readRDS(file.path(filedir, "data.all.no.log.rds"))
pdf("figs/test.processed/boxplot.pdf")
boxplot(BATOT~set, data = data.all, las = 3)
boxplot(D~set, data = data.all, las = 3)
boxplot(D~set, data = data.all, las = 3)
boxplot(G~set, data = data.all, las = 3)
boxplot(BA.G~set, data = data.all, las = 3)
par(mar = c(10, 4, 4, 4))
barplot(tapply((data.all$Pheno.T=='D'), data.all$ecocode,
......@@ -47,7 +47,7 @@ to.dev(fun.plot.xy.set(data.all, var.x = 'D', var.y = 'BA.G', cex = 0.6),
dev = png,
filename = "figs/test.processed/fig.xy.D.BA.G.set.png")
to.dev(fun.plot.xy.set(data.all, var.x = 'D', var.y = 'G',
cex = 0.6, col = col.vec[data.all$set]), dev = png,
cex = 0.6), dev = png,
filename = "figs/test.processed/fig.xy.D.G.set.png")
to.dev(fun.plot.xy.set(data.all, var.x = 'BATOT', var.y = 'G', cex = 0.6),
dev = png,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment