Learn R Programming

qdap (version 2.2.1)

Animate.character: Animate Character

Description

Animate.character - Animate a character object. Typically this function is useful in conjunction with other Animate objects to create complex animations with accompanying text.

Usage

## S3 method for class 'character':
Animate(x, wc.time = TRUE, time.constant = 2,
  width = 65, coord = c(0, 0.5), just = c(0, 0.5), size = 5,
  color = "black", border.color = NA, ...)

Arguments

x
A character object.
wc.time
logical. If TRUE weights duration of frame by word count.
time.constant
A constant to divide the maximum word count by. Time is calculated by `round(exp(WORD COUNT/(max(WORD COUNT)/time.constant)))`. Therefore a larger constant will make the difference between the large and small word counts greater.
width
The width to break text at if type = "text".
coord
The x/y coordinate to plot the text..
just
The hjust and vjust values to use for the text.
size
The size to print the text. Can be a vector of length 1 or equal to the length of x.
color
The color to print the text. Can be a vector of length 1 or equal to the length of x.
border.color
The panel.border color (seetheme).
...
Other arguments passed to annotate.

Details

character Method for Animate

See Also

theme

Examples

Run this code
Animate(DATA[["state"]])
Animate(DATA[["state"]], color="red")
Animate(DATA[["state"]], color=RColorBrewer::brewer.pal(11, "Set3"), size=10)
cls <- DATA[["person"]] %l% data.frame(levels(DATA[["person"]]),
    RColorBrewer::brewer.pal(5, "Set3"))
Animate(DATA[["state"]], color=cls, size=10, width=30)
cls2 <- DATA[["sex"]] %l% data.frame(c("m", "f"),c("lightblue", "pink"))
Animate(DATA[["state"]], color=cls2, just=c(.5, .5), coord = c(.5, .5))

## Print method
print(Animate(DATA[["state"]], color=cls2, just=c(.5, .5), coord = c(.5, .5)),
    pause=.25)
Animate(DATA[["state"]], color=sample(colors(), nrow(DATA)),
    size=sample(4:13, nrow(DATA), TRUE), width=30,  just=c(.5, .5), coord = c(.5, .5))

Run the code above in your browser using DataLab