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.
rp.bubbleplot(x, y, year, size, col, col.palette = topo.colors(20),
interpolate = FALSE, fill.in = FALSE, labels = rownames(x),
hscale = 1, vscale = hscale)
Nothing is returned.
a matrix of values, whose columns correspond to time points, to be plotted on the horizontal axis.
a matrix of values, whose columns correspond to time points, to be plotted on the vertical axis.
a vector of values, usually years, over which the scatterplot will be animated. The values in this vector correspond to the columns of x
and y
.
a vector or matrix of values used to scale the sizes of the plotted points.
a vector or matrix of values which will be translated into the colours of the plotted points.
the colour palette used to colour the points.
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 year
.
a logical variable which controls whether gaps resulting from missing data are filled in with the largest previous value.
the labels of the plotted points, used to highlight individual points on the scatterplot.
scaling parameters for the size of the plot when panel.plot
is set to TRUE
.
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.
rpanel: Simple interactive controls for R functions using the tcltk package. Journal of Statistical Software, 17, issue 9.
if (FALSE) {
rp.bubbleplot(log(gdp), log(co2.emissions), 1960:2007, size = population,
col = life.expectancy, interpolate = TRUE)
}
Run the code above in your browser using DataLab