User Tools

Site Tools


en:ordiagrams_rscript

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

en:ordiagrams_rscript [2019/02/05 21:50] (current)
David Zelený created
Line 1: Line 1:
 +<code rsplus>
 +# Plotting ordination diagrams (ordination diagrams - theory)
  
 +png ('​ordiplots_dune.png',​ width = 8, height = 8, units = '​in',​ pointsize = 11, res = 300)
 +par (mfrow = c(2,2))
 +
 +PCA <- rda (spe)
 +biplot (PCA, scaling = 2, main = '​PCA'​)
 +
 +
 +CA <- cca (spe)
 +plot (CA, main = '​CA',​ scaling = 2)
 +
 +
 +RDA <- rda (spe ~ Moisture + Management, env)
 +#anova (RDA, by = '​margin'​)
 +plot_RDA <- plot (RDA, scaling = 2, main = '​RDA',​ type = '​n'​)
 +text (plot_RDA, what = '​sp',​ arrow = T, length = 0.05, col='​red',​ cex=0.7)
 +text (plot_RDA, what = '​si',​ cex = 0.7)
 +text (plot_RDA, what = '​centroids',​ col = '​blue'​)
 +text (plot_RDA, what = '​biplot',​ arrow = TRUE, length = 0.05, col = '​blue',​ xpd = TRUE)
 +
 +CCA <- cca (spe ~ Moisture + Management, env)
 +#anova (CCA, by = '​margin'​)
 +plot_CCA <- plot (CCA, scaling = 2, main = '​CCA',​ type = '​n'​)
 +text (plot_CCA, what = '​sp',​ col='​red',​ cex=0.7)
 +text (plot_CCA, what = '​si',​ cex = 0.7)
 +text (plot_CCA, what = '​centroids',​ col = '​blue'​)
 +text (plot_CCA, what = '​biplot',​ arrow = TRUE, length = 0.05, col = '​blue',​ xpd = TRUE)
 +
 +dev.off ()
 +
 +png ('​ordiplots_types.png',​ width = 8, height = 8/3, units = '​in',​ pointsize = 14, res = 300)
 +par (mfrow = c(1,3))
 +ordiplot (CCA, display = '​si',​ ann = F, axes = F)
 +box ()
 +title (main = '​Scatterplot',​ sub = '(o = sample scores)'​)
 +
 +ordiplot (CCA, display = c('​si',​ '​sp'​),​ ann = F, axes = F)
 +box ()
 +title (main = '​Biplot',​ sub = '(o = sample, + = species scores)'​)
 +
 +plot_CCA <- plot (CCA, type = '​n',​ ann = F, axes = F)
 +box ()
 +points (CCA, display = '​sp',​ col = '​red',​ cex = 0.6, pch = '​+'​)
 +points (CCA, display = '​si',​ cex = 0.6)
 +text (plot_CCA, what = '​centroids',​ col = '​blue',​ labels = rep ('​X',​ 4), cex = 0.6)
 +text (plot_CCA, what = '​biplot',​ arrow = TRUE, length = 0.05, col = '​blue',​ xpd = TRUE, labels = ''​)
 +
 +title (main = '​Triplot',​ sub = '(o = sample, + = species scores,​\nvector & centroid = env. vars)'​)
 +box ()
 +dev.off ()
 +</​code>​
en/ordiagrams_rscript.txt · Last modified: 2019/02/05 21:50 by David Zelený