world_bank_movie | R Documentation |
Explores graphically relationships between four annual World Development Indicators provided in the World Bank's database for the countries of the world, 1960-2014. Animation is used to visualise how these variables and their inter-relationships vary over time.
The example code in Examples below creates a scatter
plot of data on the variables
given by the first two arguments of the function, i.e.
log(gdp_per_capita)
and log(co2_per_capita)
.
Each pair of values in represented by a circle. The area of the
circle is proportional to the argument size
, i.e.
population_size
and the argument col
indicates the
approximate value of the fourth variable, i.e. life_expectancy
.
The scatter plot can be animated over years and points for an individual country can be highlighted in red by clicking the name of the country.
See rp.bubbleplot
for more information.
This type of plot was used to great effect by Hans Rosling. To see Hans explain in simple terms the scientific and political issues surrounding these data see this video
Nothing is returned, only the animation is produced.
stat0002movies
: general information about the movies.
world_bank
: description of the World Bank Data.
rp.bubbleplot
: function in the
rpanel.package
package used to produce this movie.
# Produce the movie. You may ignore the warning message that is produced.
# (I think the cause may be that some countries have a lot of missing data.)
got_tcltk <- requireNamespace("tcltk", quietly = TRUE)
if (got_tcltk) {
rpanel::rp.bubbleplot(log(gdp_per_capita), log(co2_per_capita), 1960:2014,
size = population_size, col = life_expectancy,
interpolate = TRUE, hscale = 1.5, vscale = 1.5)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.