Getting started with googleVis

Markus Gesmann, November 2011

How this presentation works

This presentation uses the deck.js jQuery frame­work for cre­at­ing HTML pre­sen­ta­tions by Caleb Troughton.

Introduction to googleVis


  • In 2006 Hans Rosling gave an inspiring talk at TED about social and economic developments in the world over the past 50 years, which challenged the views and perceptions of many listeners.

  • To visualise his talk, he and his team at Gapminder had developed animated bubble charts, aka motion charts.

Google Visualisation API

Motion chart example

Source code of the motion chart

Key ideas of googleVis

History of googleVis

Version 0.2.11 provides interfaces to:

  • Motion Charts
  • Annotated Time Lines
  • Maps
  • Geo Maps and Charts
  • Intensity Maps
  • Tables
  • Gauges
  • Tree Maps
  • Line-, Bar-, Column-, Area- and Combo Charts
  • Scatter-, Candlestick-, Pie- and Org Charts

The googleVis concept

  • Charts: 'gvis' + ChartType
    For a motion chart we have
    gvisMotionChart(data, idvar='id', timevar='date', options=list(), chartid)
  • Output of googleVis is a list of list
  • Specific parts can be extracted, e.g. the data or chart
  • This is particular helpful if the package functions are used in solutions where the user wants to feed the visualisation output into other sites

Embedding googleVis chart into your web page

Suppose you have an existing web page and would like to integrate the output of a googleVis function, such as gvisMotionChart.

In this case you only need the chart output from gvisMotionChart. So you can either copy and paste the output from the R console

R> print(M, 'chart') ## or cat(M$html$chart)
into your existing html page, or write the content directly into a file

R> print(M, 'chart', file='myfilename')
and process it from there.

World Bank Example


Setting options

Line chart example

Mapping data with a geo chart

  • Here is a little example how you can use the googleVis package to display the participants of the R user conference 2011 in Warwick with a Geo Chart.

  • Please note the gvis-editor option to customise the chart
  • useR!2011 participants by country

    Merging gvis-objects

    Outlook: Event Listeners

    Here is an example to look up the selected item in Wikipedia:

    Event listener example

    Click on a coloured country and Wikipedia will be launched.


    Thank you

    Thanks to ...

    Thanks to ...