R interface to Google Chart Tools

[This article was first published on Spatial Analysis » R, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

Hans Rosling eat your heart out! It is now possible to interface R statistics software to Google’s Gapminder inspired Chart Tools. The plots below were produced using the googleVis R package and three datasets from the Gapminder website. The first shows the relationship between income, life expectancy and population for 20 countries with the highest life expectancy in 1979 and the bottom plot shows the countries with the lowest 1979 life expectancy. Press play to see how the countries have faired over the past 50 years. You can also change the variables represented on each axes, the colours and the variable that controls the size of the bubbles.

Data: all_date, Chart ID: MotionChart_2011-01-10-10-16-25

R version 2.12.1 (2010-12-16),

Google Terms of Use

Data: all_date, Chart ID: MotionChart_2011-01-10-10-10-46

R version 2.12.1 (2010-12-16),

Google Terms of Use

It was a bit fiddly to get the data formatted correctly and I couldn’t manage to get the complete dataset in one plot because my browser kept crashing (Chrome is best). Even with these teething problems it is a great way to get people creating better visualizations with their data. If you want to see Hans Rosling demonstrating these plots with his trademark enthusiasm I thoroughly recommend “The Joy of Stats” a program produced for the BBC. You can watch it here.

For those who want to create their own plots, I’m not proud of the code I used to format the data above so to get you started try this example (provided with the package).



M1 <- gvisMotionChart(Fruits, idvar=”Fruit”, timevar=”Year”)


Thanks to the Recology blog for promoting this.

To leave a comment for the author, please follow the link and comment on their blog: Spatial Analysis » R.

R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)