04 ggplot2三部曲最终之进阶为菜鸟
开始之前
chic <- readr::read_csv("https://raw.githubusercontent.com/Z3tt/R-Tutorials/master/ggplot2/chicago-nmmaps.csv")> glimpse(chic)
Rows: 1,461
Columns: 10
$ city <chr> "chic", "chic", "chic", "chic", "chic", "chic", "chic", "ch…
$ date <date> 1997-01-01, 1997-01-02, 1997-01-03, 1997-01-04, 1997-01-05…
$ death <dbl> 137, 123, 127, 146, 102, 127, 116, 118, 148, 121, 110, 127,…
$ temp <dbl> 36.0, 45.0, 40.0, 51.5, 27.0, 17.0, 16.0, 19.0, 26.0, 16.0,…
$ dewpoint <dbl> 37.500, 47.250, 38.000, 45.500, 11.250, 5.750, 7.000, 17.75…
$ pm10 <dbl> 13.052268, 41.948600, 27.041751, 25.072573, 15.343121, 9.36…
$ o3 <dbl> 5.659256, 5.525417, 6.288548, 7.537758, 20.760798, 14.94087…
$ time <dbl> 3654, 3655, 3656, 3657, 3658, 3659, 3660, 3661, 3662, 3663,…
$ season <chr> "Winter", "Winter", "Winter", "Winter", "Winter", "Winter",…
$ year <dbl> 1997, 1997, 1997, 1997, 1997, 1997, 1997, 1997, 1997, 1997,…1. ggplot 的元素对象

2. ggplot2 的几何对象


3. 映射

手动设置与映射
shape
color/fill

分类变量颜色


处理连续性变量颜色


更多颜色的知识
4. 分面
facetgrid()

facet_warp()


warp与grid 的区别
一些参数

5. 坐标轴
限定坐标区域
调整坐标比例

利用函数处理

其他参数
6. 主题
文本属性

文本位置

和图例较劲
背景与画布

网格

边界
调整分面的文字带


自带主题

7. ggplot 中的独立对象
title
labs

8. 拼图
cowplot/gridExtra


易错点
Last updated




















