Last chance! 50% off unlimited learning
Sale ends in
ani.options(...)
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
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.options
,
dev.interactive
, saveHTML
,
saveMovie
, saveLatex
,
saveSWF
, pdftk
## 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