rp.bubbleplot {rpanel} | R Documentation |
Animated scatterplot
Description
This function produces a scatterplot of two variables, with the values of third and fourth variables represented by size and colour of the plotted points. In addition, the scatterplot is animated over a fifth variable, such as time.
Usage
rp.bubbleplot(x, y, year, size, col, col.palette = topo.colors(20),
interpolate = FALSE, fill.in = FALSE, labels = rownames(x),
hscale = 1, vscale = hscale)
Arguments
x |
a matrix of values, whose columns correspond to time points, to be plotted on the horizontal axis. |
y |
a matrix of values, whose columns correspond to time points, to be plotted on the vertical axis. |
year |
a vector of values, usually years, over which the scatterplot will be animated. The values in this vector correspond to the columns of |
size |
a vector or matrix of values used to scale the sizes of the plotted points. |
col |
a vector or matrix of values which will be translated into the colours of the plotted points. |
col.palette |
the colour palette used to colour the points. |
interpolate |
a logical variable controlling whether interpolation is used to create data for plotting at year values which do not correspond to an exact values of |
fill.in |
a logical variable which controls whether gaps resulting from missing data are filled in with the largest previous value. |
labels |
the labels of the plotted points, used to highlight individual points on the scatterplot. |
hscale , vscale |
scaling parameters for the size of the plot when |
Details
This plot mimics the plots made famous by Hans Rosling through the Gapminder project (see https://www.gapminder.org). The aim of this function is to make this type of plot available directly from within R. The controls provide a slider or button for animation, plus a list of country names for individual identification.
Value
Nothing is returned.
References
rpanel: Simple interactive controls for R functions using the tcltk package. Journal of Statistical Software, 17, issue 9.
Examples
## Not run:
rp.bubbleplot(log(gdp), log(co2.emissions), 1960:2007, size = population,
col = life.expectancy, interpolate = TRUE)
## End(Not run)