Summary
Every ggplot2 plot has three key components:
- data
- aesthetic mappings
- geom function
举例:
ggplot(mpg, aes(x = displ, y = hwy)) + geom_point()
可以省略掉x
和y
,不影响结果
ggplot(mpg, aes(displ, hwy)) + geom_point()
Aesthetic Attributes
- 可以修改颜色
- 可以修改形状
- 可以修改大小
举例:
ggplot(mpg, aes(displ, cty, colour = class)) + geom_point()
网友评论