Animate.character: Animate Character

Description Usage Arguments Details See Also Examples

View source: R/Animate.character.R

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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
## 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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
## Not run: 
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))

## End(Not run)

trinker/qdap documentation built on Sept. 30, 2020, 6:28 p.m.