跳转到内容

ggplot2

维基百科,自由的百科全书

这是本页的一个历史版本,由Erwinggplot2留言 | 贡献2017年10月20日 (五) 19:12 同其他绘图包的比较编辑。这可能和当前版本存在着巨大的差异。

ggplot2
原作者Hadley Wickham英语Hadley Wickham, Winston Chang
当前版本2.2.1(2016年12月30日,​8年前​(2016-12-30
源代码库 編輯維基數據鏈接
编程语言R
许可协议GPLv2[1]
网站ggplot2.org

ggplot2
ggplot2
Base graphics
基本绘图包
使用基本绘图包与 ggplot2 预设参数绘制的简单散点图

ggplot2统计编程语言英语Computational statisticsR的一个数据可视化绘图包。ggplot2 由Hadley Wickham英语Hadley Wickham在2005年创造。它具现了利兰·威尔金森英语Leland Wilkinson所著《图标的语法—一个数据可视化通用框架》(Grammar of Graphics—a general scheme for data visualization)中将图形分解为语素(如尺度、图层)的思想。ggplot2 可以作为 R 语言基础绘图包的替代,同时 ggplot2 预设有多种印刷及网页尺寸。自 2005 年以来,ggplot2 已经发展成为最受欢迎的 R 包之一。[2][3]

更新

ggplot2 在 2012 年 3 月 2 日发布了 0.9.0 版本。本次更新提供了内部组织、尺度构建和图层等方面的众多更新。[4]

2014 年 2 月 25 日, Hadley Wickham 正式宣布 “ggplot2 正转至维护模式。意味着 ggplot2 不会再添加新的功能,不过我们会继续修复重要故障,并考虑增加由推送请求新提交的特性。为纪念这显著的里程碑,ggplot2 的下一个版本将会是 1.0.0 ”。[5]

ggplot2 在 2015 年 12 月 21 日发布了 2.0.0 版本。在版本公告中宣布了“ggplot2 现在拥有官方扩展机制。这表示其他人现在可以轻松创造他们的统计方式、几何图形和位置方案,并在其他包中提供”。[6]

同其他绘图包的比较

较 R 基础绘图包而言, ggplot2 允许用户在更抽象的层面上增加、删除或转换图表中的元素。[7] 这种抽象化的代价是执行速度。ggplot2 较 lattice 绘图包而言更耗时。[8]

R 基础绘图包使用“纸笔模型”占据绘图设备产生了一个潜在的限制。[9] Graphical output from the interpreter is added directly to the plotting device or window rather than separately for each distinct element of a plot.[10] In this respect it is similar to the lattice package, though Wickham argues ggplot2 inherits a more formal model of graphics from Wilkinson.[11] As such, it allows for a high degree of modularity; the same underlying data can be transformed by many different scales or layers.[12][13]

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

相关项目

  • ggplot for Python[17]
  • Plotly - 在线交互 ggplot2 绘图站[18]
  • gramm, 一个由 ggplot2 提供灵感的 Matlab 绘图工具[19]

参考文献

  1. ^ https://cran.r-project.org/web/packages/ggplot2/index.html
  2. ^ Wickham, Hadley. ggplot2: Elegant Graphics for Data Analysis. Journal of Statistical Software. July 2010, 35 (1). 
  3. ^ Wilkinson, Leland. ggplot2: Elegant Graphics for Data Analysis by WICKHAM, H. Biometrics. June 2011, 67 (2): 678–679. doi:10.1111/j.1541-0420.2011.01616.x. 
  4. ^ ggplot2 Development Team. Changes and Additions to ggplot2-0.9.0 (PDF). 
  5. ^ ggplot2 Development Team. Changes and Additions to ggplot2-0.9.0 (PDF). 
  6. ^ ggplot 2.0.0 http://blog.rstudio.org/2015/12/21/ggplot2-2-0-0/
  7. ^ Smith, David. Create beautiful statistical graphics with ggplot2. Revolutions. Revolution Analytics英语Revolution Analytics. [11 July 2011]. 
  8. ^ http://learnr.wordpress.com/2009/08/26/ggplot2-version-of-figures-in-lattice-multivariate-data-visualization-with-r-final-part/
  9. ^ Wickham, Hadley. ggplot2: Elegant Graphics for Data Analysis. Springer. 2009: 5. ISBN 978-0-387-98140-6. 
  10. ^ Murrell, Paul. R Graphics. Wiley Interdisciplinary Reviews: Computational Statistics. August 2009, 1 (2): 216–220. doi:10.1002/wics.22. 
  11. ^ Sarkar, Deepayan. Lattice: multivariate data visualization with R. Springer. 2008: xi. ISBN 978-0-387-75968-5. 
  12. ^ Teetor, Paul. R Cookbook. O'Reilly. 2011: 223. ISBN 978-0-596-80915-7. 
  13. ^ Wickham, Hadley. A Layered Grammar of Graphics. Journal of Computational and Graphical Statistics. March 2010, 19 (1): 3–28. doi:10.1198/jcgs.2009.07098. 
  14. ^ R Development Core Team. R: A language and environment for statistical computing. Vienna, Austria: R Foundation for Statistical Computing. 2011. ISBN 3-900051-07-0. 
  15. ^ Ginestet, Cedric. ggplot2: Elegant Graphics for Data Analysis. Journal of the Royal Statistical Society, Series A. January 2011, 174 (1): 245–246. doi:10.1111/j.1467-985X.2010.00676_9.x. 
  16. ^ Muenchen, Robert A.; Hilbe, Joseph M. Graphics with ggplot2. R for STATA Users. Springer. ISBN 978-1-4419-1317-3. doi:10.1007/978-1-4419-1318-0_16. 
  17. ^ ggplot for Python. yhat. [12 October 2014]. 
  18. ^ Interactive, online ggplot2 graphs. plotly. [12 October 2014]. 
  19. ^ ggplot for Matlab. gramm. [11 December 2015]. 

延伸阅读

外部链接