Jump to content

ggplot2

From Wikipedia, the free encyclopedia

This is an old revision of this page, as edited by Bmordue (talk | contribs) at 15:22, 15 October 2012 (subject-verb agreement). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.


ggplot2
ggplot2
Base graphics
Base graphics
ggplot2 and base graphics defaults for a simple scatterplot image

ggplot2 is a data visualization package for the statistical programming language R. Created by Hadley Wickham in 2005, ggplot2 as an implementation of Leland Wilkinson's Grammar of Graphics--a general scheme for data visualization which breaks up graphs into semantic components such as scales and layers. ggplot2 can serve as a replacement for the base graphics in R and contains a number of defaults for web and print display of common scales. Since 2005, ggplot2 has grown in use to become one of the more popular R packages.[1][2] It is licensed under GNU GPL v2.[3]

On 2 March 2012, ggplot2 version 0.9.0 was released with numerous changes to internal organization, scale construction and layers.[4] An update dealing primarily with bug fixes was released on 9 May 2012, incrementing the version to 0.9.1.[5]

Comparison with base graphics and other packages

In contrast to base R graphics, ggplot2 allows the user to add, remove or alter components in a plot at a high level of abstraction.[6] This abstraction comes at a cost, with ggplot2 approximately 7 times slower than lattice graphics.[7]

One potential limitation of base R graphics is the "pen-and-paper model" utilized to populate the plotting device.[8] Graphical output from the interpreter is added directly to the plotting device or window rather than separately for each distinct element of a plot.[9] In this respect it is similar to the lattice package, though Wickham argues ggplot2 inherits a more formal model of graphics from Wilkinson.[10] As such it allows for a high degree of modularity; the same underlying data can be transformed by many different scales or layers.[11][12]

Plots may be created via the convenience function qplot() where arguments and defaults are meant to be similar to base R's plot() function.[13][14] More complex plotting capacity is available via ggplot() which exposes the user to more explicit elements of the grammar.[15]

References

  1. ^ Wickham, Hadley (2010). "ggplot2: Elegant Graphics for Data Analysis". Journal of Statistical Software. 35 (1). {{cite journal}}: Unknown parameter |month= ignored (help)
  2. ^ Wilkinson, Leland (2011). "ggplot2: Elegant Graphics for Data Analysis by WICKHAM, H". Biometrics. 67 (2): 678–679. doi:10.1111/j.1541-0420.2011.01616.x. {{cite journal}}: Unknown parameter |month= ignored (help)
  3. ^ http://cran.r-project.org/web/packages/ggplot2/index.html
  4. ^ ggplot2 Development Team. "Changes and Additions to ggplot2-0.9.0" (PDF).{{cite web}}: CS1 maint: numeric names: authors list (link)
  5. ^ Comprehensive R Archive Network (CRAN). "Package ggplot2".
  6. ^ Smith, David. "Create beautiful statistical graphics with ggplot2". Revolutions. Revolution Analytics. Retrieved 11 July 2011.
  7. ^ http://learnr.wordpress.com/2009/08/26/ggplot2-version-of-figures-in-lattice-multivariate-data-visualization-with-r-final-part/
  8. ^ Wickham, Hadley (2009). ggplot2: Elegant Graphics for Data Analysis. Springer. p. 5. ISBN 978-0-387-98140-6.
  9. ^ Murrell, Paul (2009). "R Graphics". Wiley Interdisciplinary Reviews: Computational Statistics. 1 (2): 216–220. doi:10.1002/wics.22. {{cite journal}}: Unknown parameter |month= ignored (help)
  10. ^ Sarkar, Deepayan (2008). Lattice: multivariate data visualization with R. Springer. pp. xi. ISBN 978-0-387-75968-5.
  11. ^ Teetor, Paul (2011). R Cookbook. O'Reilly. p. 223. ISBN 978-0-596-80915-7.
  12. ^ Wickham, Hadley (2010). "A Layered Grammar of Graphics". Journal of Computational and Graphical Statistics. 19 (1): 3–28. doi:10.1198/jcgs.2009.07098. {{cite journal}}: Unknown parameter |month= ignored (help)
  13. ^ R Development Core Team (2011). R: A language and environment for statistical computing. Vienna, Austria: R Foundation for Statistical Computing. ISBN 3-900051-07-0.
  14. ^ Ginestet, Cedric (2011). "ggplot2: Elegant Graphics for Data Analysis". Journal of the Royal Statistical Society: Series A. 174 (1): 245–246. doi:10.1111/j.1467-985X.2010.00676_9.x. {{cite journal}}: Unknown parameter |month= ignored (help)
  15. ^ Muenchen, Robert A. "Graphics with ggplot2". R for STATA Users. Springer. doi:10.1007/978-1-4419-1318-0_16. ISBN 978-1-4419-1317-3. {{cite book}}: Unknown parameter |coauthor= ignored (|author= suggested) (help)

Further reading