User Tools

Site Tools


en:scripts:ordirgl_animation

3D ordination diagrams - GIF animation

You need to first install ImageMagick software (free); while installing, make sure that at the third window of the installation wizard, you choose the options “Add application directory to your system path” and “Install legacy utilites (e.g. covert)” (without convert.exe the function creating the movie will not work).

Make sure to install the library magick. To use the function orglhull, you need to have the library geometry installed, and the function orglhull needs to be defined from the link provided in the code.

veg.data <- read.delim ('https://raw.githubusercontent.com/zdealveindy/anadat-r/master/data/vltava-spe.txt', row.names = 1)
env.data <- read.delim ('https://raw.githubusercontent.com/zdealveindy/anadat-r/master/data/vltava-env.txt')
 
library (vegan)
library (vegan3d)
library (rgl)
library (magick)
 
temp.dir <- tempdir ()
 
DCA <- decorana (veg = log1p (veg.data))
 
rgl.bg (color = 'white')  # makes the background white
ordirgl (DCA)
movie3d( spin3d(axis = c(0,1,0)), duration=60/5, movie = "ordirgl", fps = 20, dir = temp.dir)
 
orglspider (DCA, groups = env.data$GROUP)
movie3d( spin3d(axis = c(0,1,0)), duration=60/5, movie = "orglspider", fps = 20, dir = temp.dir)
 
library (geometry)
source ('http://www.davidzeleny.net/anadat-r/doku.php/en:customized_functions:orglhull?do=export_code&codeblock=1')
orglhull (DCA, groups = env.data$GROUP, col = 'tomato', alpha = 0.5)
movie3d( spin3d(axis = c(0,1,0)), duration=60/5, movie = "orglhull", fps = 20, dir = temp.dir)
 
# Gif files are stored in tempdir:
temp.dir
en/scripts/ordirgl_animation.txt · Last modified: 2019/01/12 00:55 by David Zelený