Create a video of a given trait recorded in the phenoArch platform. This tutorial will use the imageGreenhouse() function and the animation R package.
https://cran.r-project.org/package=animation
SystemRequirements: ImageMagick (http://imagemagick.org) or GraphicsMagick (http://www.graphicsmagick.org) or LyX (http://www.lyx.org) for saveGIF(); (PDF)LaTeX for saveLatex(); SWF Tools (http://swftools.org) for saveSWF(); FFmpeg (http://ffmpeg.org) or avconv (https://libav.org/avconv.html) for saveVideo()
#-- Loading of librairies library(tidyr) library(dplyr) library(phisStatR) library(animation)
# import a temporal dataframe from phisStatR package: data(plant1) str(plant1) head(plant1) # Number of Days in the dataframe (in the experiment) table(plant1[,"Day"]) plant1<-arrange(plant1,Day)
The code below is not evaluated but just presented. Indeed, to create a video, R must save each temporal graphic in a repertory and then create the video using all the files. We just here show how to do this. Please try it with your own path and folder hierarchy.
#---------------------------------------------------- #heat map biovolume per Day and creation of a gif video #---------------------------------------------------- vecDay<-na.omit(unique(plant1[,"Day"])) videoFileName<-"biovolume" saveVideo({ for (tmpday in 1:length(vecDay)){ imageGreenhouse(datain=filter(plant1,Day==vecDay[tmpday]),trait="biovolume",typeD=1,typeT=1,ylim=NULL, xcol="Line",ycol="Position",numrow=28,numcol=60, typeI="video") } ani.options(interval = 1,ani.dev="png",ani.height=480) }, video.name = paste0(thepath,"/output/",videoFileName,".gif"), other.opts = paste0("-y -r ",length(vecDay)+2," -i Rplot%d.png -dframes ", length(vecDay)+2," -r ",length(vecDay)+2) ) # Call the video in a Rmarkdown file #![](/my-path-to-project/output/humidity.gif)
sessionInfo()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.