Rosling.bubbles: The bubbles animation in Hans Rosling's Talk

Description Usage Arguments Details Value Author(s) References See Also

View source: R/Rosling.bubbles.R

Description

In Hans Rosling's attractive talk “Debunking third-world myths with the best stats you've ever seen”, he used a lot of bubble plots to illustrate trends behind the data over time. This function gives an imitation of those moving bubbles, besides, as this function is based on symbols, we can also make use of other symbols such as squares, rectangles, thermometers, etc.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
Rosling.bubbles(
  x,
  y,
  data,
  type = c("circles", "squares", "rectangles", "stars", "thermometers", "boxplots"),
  bg,
  xlim = range(x),
  ylim = range(y),
  main = NULL,
  xlab = "x",
  ylab = "y",
  ...,
  grid = TRUE,
  text = 1:ani.options("nmax"),
  text.col = rgb(0, 0, 0, 0.5),
  text.cex = 5
)

Arguments

x, y

the x and y co-ordinates for the centres of the bubbles (symbols). Default to be 10 uniform random numbers in [0, 1] for each single image frame (so the length should be 10 * ani.options('nmax'))

type, data

the type and data for symbols; see symbols. The default type is circles.

bg, main, xlim, ylim, xlab, ylab, ...

see symbols. Note that bg has default values taking semi-transparent colors.

grid

logical; add a grid to the plot?

text

a character vector to be added to the plot one by one (e.g. the year in Rosling's talk)

text.col, text.cex

color and magnification of the background text

Details

Suppose we have observations of n individuals over ani.options('nmax') years. In this animation, the data of each year will be shown in the bubbles (symbols) plot; as time goes on, certain trends will be revealed (like those in Rosling's talk). Please note that the arrangement of the data for bubbles (symbols) should be a matrix like A_{ijk} in which i is the individual id (from 1 to n), j denotes the j-th variable (from 1 to p) and k indicates the time from 1 to ani.options('nmax').

And the length of x and y should be equal to the number of rows of this matrix.

Value

NULL.

Author(s)

Yihui Xie

References

Examples at https://yihui.org/animation/example/rosling-bubbles/

TED talk: https://www.ted.com/talks/hans_rosling_the_best_stats_you_ve_ever_seen

See Also

symbols


animation documentation built on Oct. 7, 2021, 9:18 a.m.