In this lab we will look at some examples of interactive plotting using the googleVis package. This provides an interface to the Google Visualization API, which can be used to make interactive graphics and is widely used for web-based figures. The level of interactivity varies from simple mouseover plots (where holding the cursor over the plot will provide extra information) to plots where you can select the variables to use.
## Get development data
require(googleVis)
require(reshape2)
op <- options(gvis.plot.tag="chart")
development = read.csv("development.csv")
country.sel = c("United States", "China", "India", "Germany", "Russian Federation")
development_plot <- subset(development, Country %in% country.sel)
## Bar plots etc
development_plot <- subset(development_plot, Year >= 2010)
## 1
plot.df = dcast(development_plot, Country ~ Year, value.var = "GDP")
Bar = gvisBarChart(plot.df)
plot(Bar)
Bar = gvisBarChart(plot.df, options=list(hAxes="[{logScale:true}]"))
plot(Bar)
Bar = gvisBarChart(plot.df, options=list(hAxes="[{logScale:true}]",
width=550, height=500))
plot(Bar)
Col = gvisColumnChart(plot.df, options=list(vAxes="[{logScale:true}]",
width=550, height=500))
plot(Col)
Table = gvisTable(plot.df)
plot(Table)