====== 3D ordination diagrams - GIF animation ====== 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