Visualizing Multiple Data Sets with BubblePlot
The BubblePlot command can convey information about three dimensions of a multidimensional data set using the horizontal axis, the vertical axis, and point (bubble) size. Moreover, if a data set is a time series, BubblePlot can generate an animation that shows the movement of data points over a common period of time.
In the following example, data sets containing information on Gross Domestic Product (GDP) at Purchasing Power Parity (PPP), Life Expectancy, and Population are retrieved for selected countries and visualized.
To begin, load the DataSets and Statistics packages.
List of countries with their three-letter country codes. Right-click (Control-click, on Mac) and select Expand Code Edit Region to see the list.
The next three steps create Vectors containing data sets on GDP at PPP, Life Expectancy, and Population for each of the countries in the code edit region above. We can make use of the fact many data sources use a standardized three-letter country code to represent a specific country while building the unique identifier for each data set.
Note: This example downloads data for 540 data sets. This may take some time. It is possible to view the cached animation below without loading any data by clicking the plot and using the animation toolbar controls.
Gross Domestic Product at Purchasing Power Parity
Source: Open Data for Africa
ds1≔Vector x→Referencequandl,catODA/,x, _PPPPC~entriesCountries,nolist,indexorder:
ds2≔Vector x→Referencequandl,catWWDI/,x, _SP_DYN_LE00_IN~entriesCountries,nolist,indexorder:
ds3≔Vector x→Referencequandl,catWWDI/,x, _SP_POP_TOTL~entriesCountries,nolist,indexorder:
The following is an animated BubblePlot of GDP at PPP vs. Life Expectancy, where bubble sizes correspond to the population of listed countries. The current year can be seen below the legend. To play back the animation, click the plot to select it and then use the animation toolbar controls.
BubblePlotds1,ds2,ds3, data_legend=GDP at PPP, Life Expectancy,Population, bubble_legend=indicesCountries,nolist, indexorder, frames = 50, size=1400,1100,gridlines,font=Calibri,14
All of the above data sets are taken from the online data aggregator Quandl. Each data set has a unique identifier. A sample for each of the three topic areas: GDP at PPP, Life Expectancy, and Population is listed below:
Canada Per Capita GDP based on PPP Valuation, USD
Canada: Life expectancy at birth, total (years)
Canada: Population, total
Return to Example Worksheet Index
Download Help Document