Under the supervision of Dr. Paul Murrell I undertook an honours project working on gridSVG. gridSVG is a package for R that turns a grid plot into an SVG image. A basic illustration of how gridSVG differs from the SVG device is shown below.
The advantage of using gridSVG is that new animated, interactive graphics can be produced more easily and transparently than by using the Cairo-based SVG device (see SVGAnnotation for an alternative approach that uses the SVG device). Because the lattice and ggplot2 packages use grid, gridSVG can add these features to plots produced by these packages. As gridSVG only works with grid plots, to create animated and interactive plots from R’s base graphics engine, see SVGAnnotation.
Prior to my work on gridSVG, it was able to produce basic plots but lacked support for many of grid’s graphics objects. On top of this, many of the graphics objects that were supported by gridSVG were not implemented correctly. An example where this was the case is when single grid graphics objects are required to turn into multiple SVG elements, either by vectorised parameters or objects with the
After implementing almost all grid graphics objects and supporting their behaviour to a reasonable degree of accuracy, we can now reproduce lattice and ggplot2 plots using gridSVG. This means lattice and ggplot2 plots can make use of animation, interactivity and hyperlinking.
- Download gridSVG via CRAN. To install gridSVG simply run
install.packages("gridSVG")from within R.
- Download development version of gridSVG via R-Forge (not recommended)
Note: this documentation lags behind the latest version, use the documentation provided with the package for up to date information.
Documentation of the behaviour of gridSVG 0.7-0 is available below. Further information on the behaviour of gridSVG is available in Section 4 of my honours report.
Many of the limitations noted in the listed documentation are no longer present in newer versions of gridSVG.
Demonstrations of the potential of gridSVG (using version 0.7-0) are linked below. Note that a modern web browser is required to view these images. Google Chrome, Mozilla Firefox and Opera are all capable of viewing these examples.