更多色彩刻度

在 R 視覺化地理空間資料

Charlotte Wickham

Assistant Professor at Oregon State University

數值對應到顏色

  • ggplot2:對應為連續色彩漸層

    • 連續映射:透過縮放轉換(例如 log)控制映射
  • tmap:對應為離散色彩集合

    • 離散映射:用分箱方式控制映射

連續色彩刻度

離散色彩刻度

在 R 視覺化地理空間資料

離散 vs. 連續映射

  • 連續:
    • 知覺均勻:數值差相同時,顏色差也等幅
  • 離散:
    • 完全掌控刻度
    • 更容易查找
在 R 視覺化地理空間資料

變數分箱(equal)

library(classInt)

classIntervals(values, n = 5, style = "equal")
style: equal
[190135.1,208293.7) [208293.7,226452.4) [226452.4,244611.1) [244611.1,262769.7) [262769.7,280928.4] 
                537                 528                 351                 131                  53

等距分箱

在 R 視覺化地理空間資料

變數分箱

classIntervals(values, n = 5, style = "quantile")
style: quantile
[190135.1,201403.2) [201403.2,211412.2) [211412.2,220703.1) [220703.1,237403.2) [237403.2,280928.4] 
                320                 320                 320                 320                 320

分位數分箱

在 R 視覺化地理空間資料

變數分箱

classIntervals(values, n = 5, style = "pretty")
style: pretty
[180000,2e+05)  [2e+05,220000) [220000,240000) [240000,260000) [260000,280000)  [280000,3e+05] 
           279             664             394             199              62               2

漂亮分箱

在 R 視覺化地理空間資料

變數分箱

classIntervals(values, style = "fixed", 
               fixedBreaks = c(100000, 230000, 255000, 300000))
style: fixed
 [1e+05,230000) [230000,255000)  [255000,3e+05] 
           1120             390              90 

固定分箱

在 R 視覺化地理空間資料

一起來練習吧!

在 R 視覺化地理空間資料

Preparing Video For Download...