Learn R Programming

hypervolume (version 3.1.4)

hypervolume_save_animated_gif: Saves animated GIF of three-dimensional hypervolume plot.

Description

Rotates the plot around an axis at a given speed and saves results as a series of GIFs. Requires that the rgl library is installed. Assumes there is an open RGL plot (e.g. from calling plot(hv, show.3d=TRUE)). If the magick package is available, combines these GIFs into a single animation.

Usage

hypervolume_save_animated_gif(image.size = 400, 
                              axis = c(0, 0, 1), rpm = 4, duration = 15, fps = 10, 
                              file.name = "movie", directory.output = ".", ...)

Value

None; used for the side-effect of producing files.

Arguments

image.size

Number of pixels on each side of the animated image.

axis

A three-element vector describing the rotation axis.

rpm

Animation speed in rotations per minute.

duration

Animation duration in seconds.

fps

Animation speed in frames per second.

file.name

A base name (no extension) for the GIFs.

directory.output

The folder in which output should be located.

...

Other arguments to be passed to rgl::movie3d.

Examples

Run this code
if (FALSE) {
data(penguins,package='palmerpenguins')
penguins_no_na = as.data.frame(na.omit(penguins))
penguins_adelie = penguins_no_na[penguins_no_na$species=="Adelie",
                    c("bill_length_mm","bill_depth_mm","flipper_length_mm")]
  
hv = hypervolume_gaussian(penguins_adelie,name='Adelie')

if(interactive())
{
  plot(hv, show.3d=TRUE)
  hypervolume_save_animated_gif()
  rgl.close()
}
}

Run the code above in your browser using DataLab