ggpltot2是什么?

ggplot2 is a powerful and a flexible R package, implemented by Hadley Wickham, for producing elegant graphics. The gg in ggplot2 means Grammar of Graphics,a graphic concept which describes plots by using a “grammar”.[1]

Plot = data + Aesthetics + Geometry

data:数据,data frame
aethetic:指示数据的颜色,形状,大小的的参数
geometry:图形的类型
qplot():简单快速
ggplot():灵活稳健

  1. last_plot() # : returns the last plot to be modified
  2. ggsave("plot.png", width = 5, height = 5) # saves the last plot in the current working directory.

若想保存其他图形,需制定图形名称

参考资料

本系列参考书籍:

  1. [ggplot2 Data visualization] Alboukadel Kassambara - Guide to Create Beautiful Graphics in R (2013, STHDA).pdf.
  2. (第二版英文)ggplot2-elegant-graphics-data-analysis.pdf.