Learn R Programming

animation (version 2.0-5)

ani.options: Set or query animation options

Description

There are various parameters that control the behaviour of the animation, such as time interval, maximum number of animation frames, height and width, etc.

Usage

ani.options(...)

Arguments

...
arguments in tag = value form, or a list of tagged values. The tags usually come from the animation parameters described below, but they are not restricted to these tags (any tag can be used; this is similar to

Value

  • ani.options() returns a list containing the options: when parameters are set, their former values are returned in an invisible named list. Such a list can be passed as an argument to ani.options to restore the parameter values.

    ani.options('tag') returns the value of the option 'tag'.

    ani.options(c('tag1', 'tag2')) or ani.options('tag1', 'tag2') returns a list containing the corresponding options.

Details

Animation options{ The supported animation parameters: [object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object] }

Hidden options{

There are a couple of ``hidden'' options which are designed to facilitate the usage of some functions but are not initialized like the above options when the package is loaded, including:

[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],. }

References

http://animation.yihui.name/animation:options

http://qpdf.sourceforge.net/

http://www.pdflabs.com/docs/pdftk-man-page/

See Also

options, dev.interactive, saveHTML, saveGIF, saveLatex, saveSWF, pdftk

Examples

Run this code
## see the first example in help(animation) on how to set
#   and restore
##   animation options

## use the PDF device: remember to set 'ani.type'
#   accordingly
oopt = ani.options(ani.dev = "pdf", ani.type = "pdf", 
    ani.height = 5, ani.width = 7)

## use the Cairo PDF device
# if (require('Cairo')) {
#     ani.options(ani.dev = CairoPDF, ani.type = 'pdf',
#                 ani.height = 6, ani.width = 6)
# }

## change outdir to the current working directory
ani.options(outdir = getwd())

## don't loop for GIF/HTML animations
ani.options(loop = FALSE)

## don't try to open the output automatically
ani.options(autobrowse = FALSE)

## it's a good habit to restore the options in the end so
#   that
##   other code will not be affected
ani.options(oopt)

## how to make use of the hidden option 'img.fmt'
saveHTML(expr = {
    png(ani.options("img.fmt"))
    for (i in 1:5) plot(runif(10))
    dev.off()
}, img.name = "custom_plot", use.dev = FALSE, ani.type = "png", 
    htmlfile = "custom_device.html", description = "Note how we use our own graphics device in 'expr'.")

Run the code above in your browser using DataLab