Scalable Vector Graphics

  • Deborah Nolan
  • Duncan Temple Lang
Part of the Use R! book series (USE R)


This chapter explores a powerful two-dimensional graphics format named SVG (scalable vector graphics), which is becoming widely used to represent object-based, vector (nonraster) graphics both on the Web and elsewhere. In addition to displaying scalable plots, the XML-based SVG format provides functionality for interactivity, animation, and a number of filtering effects that allow us to create rich graphical displays, and also to integrate them with Web pages. R can create static SVG displays, and we can post-process them within R as XML documents to add interaction and animation. We show how to provide simple interaction and animation with high-level R functions, and also how to add more customized interaction using R commands that use JavaScript at viewing time. We also discuss how to use both SVG and HTML to create rich “applications” and mash-ups in the Web browser.


Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.


  1. [1]
    Adobe. Flash player software, version 10.3., 2011.
  2. [2]
    Apache Software Foundation. The Apache Batik project: A Java-based toolkit for applications or applets that want to use images in scalable vector graphics (SVG), version 1.7., 2008.
  3. [3]
    Gabriel Becker and Duncan Temple Lang. RBrowserPlugin: R in the Web browser., 2012. R package version 0.1-5.
  4. [4]
    Richard Becker, Allan Wilks, Ray Brownrigg, and Thomas Minka. maps: Draw geographical maps., 2011. R package version 2.1.
  5. [5]
    Alex Berger, Alex Pucher, Alexandra Medwedeff, Andreas Neumann, Andre Winter, Christian Furpass, Christian Resch, Florent Chuffart, Florian Jurgeit, Georg Held, Greg Sepesi, Iris Fibinger, Klaus Forster, Martin Galanda, Nedjo Rogers, Nicole Ueberschar, Peter Sykora, Sudhir Kumar Reddy Maddirala, Thomas Mailander, Till Voswinckel, Tobias Bruehlmeier, Torsten Ullrich, and Yvonne Barth. software., 2010.
  6. [6]
    Bert Bos, Tantek Celik, Ian Hickson, and Hakon Wium Lie. Cascading style sheets, level 2, revision 1 (CSS 2.1) specification. Worldwide Web Consortium, 2011.
  7. [7]
    Cairo Graphics. Cairo: A 2D graphics library with support for multiple output devices, version 1.1., 2006.
  8. [8]
    Dan Carr, Nicholas Lewin-Koh, and Martin Maechler. hexbin: Hexagonal binning routines., 2009. R package version 1.22.
  9. [9]
    J David Eisenberg. SVG Essentials. O’Reilly Media, Inc., Sebastopol, CA, 2002.Google Scholar
  10. [10]
    David Flanagan. JavaScript: The Definitive Guide. O’Reilly Media, Inc., Sebastopol, CA, 2006.Google Scholar
  11. [11]
    Jeffrey Horner. rApache: Web application development with R and Apache., 2011. R package version 1.2.1.
  12. [12]
    Chafic Kazoun and Joey Lott. Programming Flex 3: The Comprehensive Guide to Creating Rich Internet Applications with Adobe Flex. O’Reilly Media, Inc., Sebastopol, CA, 2008.Google Scholar
  13. [13]
    Bill Kennedy and Chuck Musciano. HTML and XHTML: The Definitive Guide. O’Reilly Media, Inc., Sebastopol, CA, 2006.Google Scholar
  14. [14]
    Jake Luciani. RSvgDevice: An RSVG graphics device., 2009. R package version 0.6.
  15. [15]
    Eric A Meyer. CSS Pocket Reference. O’Reilly Media, Inc., Sebastopol, CA, 2004.Google Scholar
  16. [16]
    Paul Murrell. R Graphics. Chapman & Hall/CRC, Boca Raton, FL, 2005.Google Scholar
  17. [17]
    Paul Murrell. gridBase: Integration of base and grid graphics.˜paul/grid/grid.html, 2006. R package version 0.4.
  18. [18]
    Paul Murrell. gridSVG: Export grid graphics as SVG.˜paul/R/gridSVG/gridSVG_0.5-10.tar.gz, 2010. R package version 0.5.
  19. [19]
    Paul Murrell. grid: The grid graphics package., 2011. R package version 2.16.0.
  20. [20]
    Andreas Neumann and Andre Winter. Vector-based Web cartography: Enable SVG., 2003.
  21. [21]
    Deborah Nolan and Duncan Temple Lang. SVGAnnotation: Tools for post-processing SVG plots created in R., 2011. R package version 0.9.
  22. [22]
    Deborah Nolan and Duncan Temple Lang. Interactive and animated scalable vector graphics and R data displays. Journal of Statistical Software, 46:1–88, 2012.Google Scholar
  23. [23]
    Dave Pawson. XSL-FO: Making XML Look Good in Print. O’Reilly Media, Inc., Sebastopol, CA, 2002.Google Scholar
  24. [24]
    Tony Plate. RSVGTipsDevice: An RSVG graphics device with dynamic tips and hyperlink., 2011. R package version 1.0.
  25. [25]
    Hans Rosling. Gapminder: World., 2008.
  26. [26]
    Barry Rowlingson. imagemap: Create HTML imagemaps., 2004. R package version 0.9.
  27. [27]
    Deepayan Sarkar. Lattice: Multivariate Data Visualization with R. Springer-Verlag, New York, 2008.
  28. [28]
    Deepayan Sarkar. lattice: Lattice graphics., 2011. R package version 0.19.
  29. [29]
    John Simpson. XPath and XPointer: Locating Content in XML Documents. O’Reilly Media, Inc., Sebastopol, CA, 2002.Google Scholar
  30. [30]
    Debby Swayne, Dianne Cook, Duncan Temple Lang, and Andreas Buja. GGobi software, version 2.1., 2010.
  31. [31]
    Duncan Temple Lang. FlashMXML: A simple Flash graphics device for R., 2011. R package version 0.2-0.
  32. [32]
    Duncan Temple Lang. XML: Tools for parsing and generating XML within R and S-PLUS., 2011. R package version 3.4.
  33. [33]
    Martin Theus. Interactive data visualization using Mondrian. Journal of Statistical Software, 7:1–9, 2002.Google Scholar
  34. [34]
    Simon Urbanek and TobiasWichtrey. iplots: Interactive graphics for R., 2011. R package version 1.1.
  35. [35]
    W3Schools, Inc. JavaScript tutorial., 2011.
  36. [36] SVG tutorial., 2011.
  37. [37]
    Hadley Wickham. ggplot2: An implementation of the Grammar of Graphics., 2010. R package version 0.8.
  38. [38]
    Carl Worth and Keith Packard. Cairo: Cross-device rendering for vector graphics.˜cworth/papers/xr_ols2003/, 2003.
  39. [39]
    Yihui Xie. animation: A gallery of animations in statistics and utilities to create animations., 2011. R package version 2.0.

Copyright information

© Springer Science+Business Media New York 2014

Authors and Affiliations

  • Deborah Nolan
    • 1
  • Duncan Temple Lang
    • 2
  1. 1.Department of StatisticsUniversity of CaliforniaBerkeleyUSA
  2. 2.Department of StatisticsUniversity of CaliforniaDavisUSA

Personalised recommendations