Pages Menu
TwitterRss
Categories Menu

Posted by on Jan 10, 2011 in Resources, Visualisation | 5 comments

R interface to Google Chart Tools

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).

library(googleVis)

data(Fruits)

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

plot(M1)

Thanks to the Recology blog for promoting this.

Share on Facebook
Bookmark this on Google Bookmarks
Share on reddit
Bookmark this on Digg
Share on StumbleUpon
Share on LinkedIn

5 Comments

  1. Great post by one of the best blogs about spatial stat.
    Thank you James.

  2. Thanks for the post James. I will be using this one tomorrow!

  3. Would u plz mail me the R code of the above two simulation.These are excellent tools.
    Many Many thanks.

    • An example of the code is provided at the end of the post.

  4. Thanks for this simple introduction.

    I was able to make the graphic on my computer, but cannot do so with others. If there is an easy way, please let me know.

    Thanks, again.

Trackbacks/Pingbacks

  1. Coming of Age: R and Spatial Data Visualisation | Spatial Analysis - [...] it has become incredibly simple to export interactive and animated graphics using the googleVIS package or igraph for network visualisations. Such flexibility …

Post a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>