googleVis 0.2.13: new stepped area chart and improved geo charts
On 7th December Google published a new version of their Visualisation API. The new version adds a new chart type: Stepped Area Chart and provides improvements to Geo Chart. Now Geo Chart has similar functionality to Geo Map, but while Geo Map requires Flash, Geo Chart doesn't, as it renders SVG/VML graphics. So it also works on your iOS devices.
library(googleVis) df <- data.frame(country=c("US", "GB", "BR"), val1=c(1,3,4), val2=c(23,12,32)) SteppedArea <- gvisSteppedAreaChart(df, xvar="country", yvar=c("val1", "val2"), options=list(isStacked=TRUE, width=400, height=150)) plot(SteppedArea2)
The interface to
gvisGeoChart changed slightly to take into account the new version of Geo Chart by Google. The argument
numvar has been renamed to
colorvar and a new argument
sizevar has been added. This allows you to set the size and colour of the bubbles in
displayMode='markers' depending on columns in your data frame. Further, you can set far more options than you could before, in particular you can set not only the
region, but also the
resolution of your map. Although more granular maps are not available for all countries, for more details see the Google documentation.
Here are two examples, plotting the test data
CityPopularity with a Geo Chart.
The first plot shows the popularity of New York, Boston, Miami, Chicago, Los Angeles and Houston on the US map, with the resolution set to
'metros' and region set to
'US'. The Google Map API makes the correct assumption about which cities we mean.
library(googleVis> ## requires googleVis version >= 0.2.13 gcus <- gvisGeoChart(CityPopularity, locationvar="City", colorvar="Popularity", options=list(displayMode="markers", region="US", resolution="metros"), chartid="GeoChart_US") plot(gcus)
In the second example we set the region to
'US-TX', therefore Google will look for cities with the same names in Texas. And what a surprise, there are cities/towns named Chicago, Los Angeles, Miami, Boston and of course Houston in Texas.
gctx <- gvisGeoChart(CityPopularity, locationvar="City", colorvar="Popularity", options=list(displayMode="markers", region="US-TX", resolution="metros"), chartid="GeoChart_TX") plot(gctx)
With the new version of the Visualisation API Google introduced also the concept of DataTable Roles. This is an interesting idea, as it allows you to add context to the data, similar to the approach used with annotated time lines. Google classifies the DataTable Roles still experimental, but it is a space to watch and ideas on how this could be translated into R will be much appreciated.
And now the news of the googleVis package since version 0.2.10:
Version 0.2.13 [2011-12-19] ========================== Changes o The list of arguments for gvisGeoChart changed: - the argument 'numvar' has been renamed to 'colorvar' to reflect the updated Google API. Additionally gvisGeoChart gained a new argument 'sizevar'. o Updated googleVis vignette with a section on using googleVis output in presentations o Renamed demo EventListner to EventListener NEW FEATURES o Google published a new version of their Visualisation API on 7 December 2011. Some of the new features have been implemented into googleVis already: - New stepped area chart function gvisSteppedAreaChart - gvisGeoChart has a new marker mode, similar to the mode in gvisGeoMap. See example(gvisGeoChart) for the new functionalities. Version 0.2.12 [2011-12-07] ========================== Bug Fixes o gvisMotionChart didn't display data with special characters, e.g. spaces, &, %, in column names correctly. Thanks to Alexander Holcroft for reporting this issue. Version 0.2.11 [2011-11-16] ========================== Changes o Updated vignette and documentation with instructions on changing the Flash security settings to display Flash charts locally. Thanks to Tony Breyal. o New example to plot weekly data with gvisMotionChart o Removed local copies of gadget files to reduce package file size. A local copy of the R script to generate the original gadget files is still included in inst/gadgets Version 0.2.10 [2011-09-24] ========================== Changes o Updated section 'Using googleVis output with Google Sites, Blogger, etc.' vignette o Updated example for gvisMotionChart, showing how the initial chart setting can be changed, e.g to display a line chart. o New example for gvisAnnotatedTimeLine, showing how to shade areas. Thanks to Mike Silberbauer for providing the initial code. NEW FEATURES o New demo WorldBank. It demonstrates how country level data can be accessed from the World Bank via their API and displayed with a Motion Chart. Inspired by Google's Public Data Explorer, see http://www.google.com/publicdata/home