所有作品合集传送门: Tidy Tuesday

2018 年合集传送门: 2018

ACS Census Data (2015)

欢迎来到`ggplot2`的世界!

ggplot2是一个用来绘制统计图形的 R 软件包。它可以绘制出很多精美的图形,同时能避免诸多的繁琐细节,例如添加图例等。

用 ggplot2 绘制图形时,图形的每个部分可以依次进行构建,之后还可以进行编辑。ggplot2 精心挑选了一系列的预设图形,因此在大部分情形下可以快速地绘制出许多高质量的图形。如果在格式上还有额外的需求,也可以利用 ggplot2 中的主题系统来进行定制, 无需花费太多时间来调整图形的外观,而可以更加转注地用图形来展现你的数据。




1. 一些环境设置

# 设置为国内镜像, 方便快速安装模块
options("repos" = c(CRAN = "https://mirrors.tuna.tsinghua.edu.cn/CRAN/"))

2. 设置工作路径

wkdir <- '/home/user/R_workdir/TidyTuesday/2018/2018-04-30_ACS_Census_Data/src-a'
setwd(wkdir)

3. 加载 R 包

# 一些 R 并非是 CRAN 官方镜像里面的, 是存放在 GitHub 中
# remotes::install_gitlab("hrbrmstr/albersusa")
# devtools::install_github(c('ramnathv/htmlwidgets', 'ramnathv/rcstatebin'))
library(Hmisc)
library(maps)
library(albersusa)
library(tidyverse)
library(plotly)
library(choroplethr)
library(choroplethrMaps)
library(geojsonio)
library(broom)
library(rgeos)
library(viridis)
library(rcstatebin)
library(statebins)# 导入字体设置包
library(showtext)
# font_add_google() showtext 中从谷歌字体下载并导入字体的函数
# name 中的是字体名称, 用于检索, 必须严格对应想要字体的名字
# family 后面的是代码后面引用时的名称, 自己随便起
# 需要能访问 Google, 也可以注释掉下面这行, 影响不大
# font_families_google() 列出所有支持的字体, 支持的汉字不多
# http://www.googlefonts.net/
font_add_google(name = "ZCOOL XiaoWei", family = "zxw")
font_add_google(name = "Gochi Hand", family =  "gochi")# 后面字体均可以使用导入的字体
showtext_auto()

4. 加载数据

# 加载数据对象
# https://team.carto.com/u/andrew/tables/andrew.us_states_hexgrid/public/map
df_input <- read.csv("../data/week5_acs2015_county_data.csv")
df_sp <- geojson_read("../data/us_states_hexgrid.geojson",  what = "sp")# 简要查看数据内容
glimpse(df_input)
## Rows: 3,220
## Columns: 37
## $ CensusId        <int> 1001, 1003, 1005, 1007, 1009, 1011, 1013, 1015, 1017, …
## $ State           <chr> "Alabama", "Alabama", "Alabama", "Alabama", "Alaalbert",…
## $ County          <chr> "Autauga", "Baldwin", "Barbour", "Bibb", "Blount", "Bu…
## $ TotalPop        <int> 55221, 195121, 26932, 22604, 57710, 10678, 20354, 1166…
## $ Men             <int> 26745, 95314, 14497, 12073, 28512, 5660, 9502, 56274, …
## $ Women           <int> 28476, 99807, 12435, 10531, 29198, 5018, 10852, 60374,…
## $ Hispanic        <dbl> 2.6, 4.5, 4.6, 2.2, 8.6, 4.4, 1.2, 3.5, 0.4, 1.5, 7.6,…
## $ White           <dbl> 75.8, 83.1, 46.2, 74.5, 87.9, 22.2, 53.3, 73.0, 57.3, …
## $ Black           <dbl> 18.5, 9.5, 46.7, 21.4, 1.5, 70.7, 43.8, 20.3, 40.3, 4.…
## $ Native          <dbl> 0.4, 0.6, 0.2, 0.4, 0.3, 1.2, 0.1, 0.2, 0.2, 0.6, 0.4,…
## $ Asian           <dbl> 1.0, 0.7, 0.4, 0.1, 0.1, 0.2, 0.4, 0.9, 0.8, 0.3, 0.3,…
## $ Pacific         <dbl> 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,…
## $ Citizen         <int> 40725, 147695, 20714, 17495, 42345, 8057, 15581, 88612…
## $ Income          <dbl> 51281, 50254, 32964, 38678, 45813, 31938, 32229, 41703…
## $ IncomeErr       <dbl> 2391, 1263, 2973, 3995, 3141, 5884, 1793, 925, 2949, 1…
## $ IncomePerCap    <int> 24974, 27317, 16824, 18431, 20532, 17580, 18390, 21374…
## $ IncomePerCapErr <int> 1080, 711, 798, 1618, 708, 2055, 714, 489, 1366, 1556,…
## $ Poverty         <dbl> 12.9, 13.4, 26.7, 16.8, 16.7, 24.6, 25.4, 20.5, 21.6, …
## $ ChildPoverty    <dbl> 18.6, 19.2, 45.3, 27.9, 27.2, 38.4, 39.2, 31.6, 37.2, …
## $ Professional    <dbl> 33.2, 33.1, 26.8, 21.5, 28.5, 18.8, 27.5, 27.3, 23.3, …
## $ Service         <dbl> 17.0, 17.7, 16.1, 17.9, 14.1, 15.0, 16.6, 17.7, 14.5, …
## $ Office          <dbl> 24.2, 27.1, 23.1, 17.8, 23.9, 19.7, 21.9, 24.2, 26.3, …
## $ Construction    <dbl> 8.6, 10.8, 10.8, 19.0, 13.5, 20.1, 10.3, 10.5, 11.5, 1…
## $ Production      <dbl> 17.1, 11.2, 23.1, 23.7, 19.9, 26.4, 23.7, 20.4, 24.4, …
## $ Drive           <dbl> 87.5, 84.7, 83.8, 83.2, 84.9, 74.9, 84.5, 85.3, 85.1, …
## $ Carpool         <dbl> 8.8, 8.8, 10.9, 13.5, 11.2, 14.9, 12.4, 9.4, 11.9, 12.…
## $ Transit         <dbl> 0.1, 0.1, 0.4, 0.5, 0.4, 0.7, 0.0, 0.2, 0.2, 0.2, 0.2,…
## $ Walk            <dbl> 0.5, 1.0, 1.8, 0.6, 0.9, 5.0, 0.8, 1.2, 0.3, 0.6, 1.1,…
## $ OtherTransp     <dbl> 1.3, 1.4, 1.5, 1.5, 0.4, 1.7, 0.6, 1.2, 0.4, 0.7, 1.4,…
## $ WorkAtHome      <dbl> 1.8, 3.9, 1.6, 0.7, 2.3, 2.8, 1.7, 2.7, 2.1, 2.5, 1.9,…
## $ MeanCommute     <dbl> 26.5, 26.4, 24.1, 28.8, 34.9, 27.5, 24.6, 24.1, 25.1, …
## $ Employed        <int> 23986, 85953, 8597, 8294, 22189, 3865, 7813, 47401, 13…
## $ PrivateWork     <dbl> 73.6, 81.5, 71.8, 76.8, 82.0, 79.5, 77.4, 74.1, 85.1, …
## $ PublicWork      <dbl> 20.9, 12.3, 20.8, 16.1, 13.5, 15.1, 16.2, 20.8, 12.1, …
## $ SelfEmployed    <dbl> 5.5, 5.8, 7.3, 6.7, 4.2, 5.4, 6.2, 5.0, 2.8, 7.9, 4.1,…
## $ FamilyWork      <dbl> 0.0, 0.4, 0.1, 0.4, 0.4, 0.0, 0.2, 0.1, 0.0, 0.5, 0.5,…
## $ Unemployment    <dbl> 7.6, 7.5, 17.6, 8.3, 7.7, 18.0, 10.9, 12.3, 8.9, 7.9, …
# 检查数据的列名
colnames(df_input)
##  [1] "CensusId"        "State"           "County"          "TotalPop"
##  [5] "Men"             "Women"           "Hispanic"        "White"
##  [9] "Black"           "Native"          "Asian"           "Pacific"
## [13] "Citizen"         "Income"          "IncomeErr"       "IncomePerCap"
## [17] "IncomePerCapErr" "Poverty"         "ChildPoverty"    "Professional"
## [21] "Service"         "Office"          "Construction"    "Production"
## [25] "Drive"           "Carpool"         "Transit"         "Walk"
## [29] "OtherTransp"     "WorkAtHome"      "MeanCommute"     "Employed"
## [33] "PrivateWork"     "PublicWork"      "SelfEmployed"    "FamilyWork"
## [37] "Unemployment"

5. 数据预处理

# 以州进行分组, 分别计算平均值
df_alb   <- df_input %>%group_by(State) %>%summarise(MeanCommute = sum(MeanCommute * TotalPop)/sum(TotalPop))

6. 利用 ggplot2 绘图

6.1 利用 albersusa 绘制地图热图

# 获得 albersusa 包中美国州县复合地图数据
uscnty <- counties_composite()
# 获得美国地图数据
usmap  <- broom::tidy(uscnty, region = "fips") %>% tibble::as_tibble() %>%dplyr::mutate(id = as.integer(id))# PS: 方便讲解, 我这里进行了拆解, 具体使用时可以组合在一起
gg <- usmap %>%# 通过 usmap 中的 id 与 df_input 中的 CensusId 关联在一起left_join(df_input, by = c("id" = "CensusId")) %>% # 以 long 为横坐标, lat 为纵坐标, group 为分组信息建立 ggplot2 画布ggplot(aes(long, lat, group = group))
# geom_polygon() 绘制的是多边形
gg <- gg + geom_polygon(aes(fill = MeanCommute), colour = "grey")
# coord_quickmap() 为地图设置合适的纵横比, 调整轴以确保经度和纬度以相同的比例呈现
gg <- gg + coord_quickmap()
# scale_fill_distiller() 色块连续过度, 通过 ?scale_fill_distiller 打开帮助页面, 在 Palettes 章节可以获得支持的所有 palette 值
gg <- gg + scale_fill_distiller(name = "通勤时间(分钟)", palette = "BrBG")
# guides() 设置图例信息
gg <- gg + guides(fill = guide_legend(frame.color = "white", title.position = "top", label.position = "bottom"))
# theme_minimal() 去坐标轴边框的最小化主题
gg <- gg + theme_minimal()
# labs() 对图形添加注释和标签(包含标题 title、子标题 subtitle、坐标轴 x & y 和引用 caption 等注释)
gg <- gg + labs(x = NULL, y = NULL, title = '2015年 - 全美通勤通勤时间',caption = '数据来源: 2015年美国人口普查数据 | GRAPH: 数绘小站')
# theme() 实现对非数据元素的调整, 对结果进行进一步渲染, 使之更加美观
gg <- gg + theme(# panel.grid.major 主网格线panel.grid.major = element_line(colour = "#333333", size = 0.25),# plot.background 图片背景plot.background = element_blank(),# plot.margin 调整图像边距, 上-右-下-左plot.margin = unit(c(.15, .1, .15, 0.1), "cm"),# plot.title 主标题plot.title = element_text(color = "black", size = 24, face = "bold", vjust = -0.5, family = 'zxw'),# axis.text 坐标轴刻度文本axis.text = element_text(size = 16, face = "bold"),# legend.position 设置图例位置, 这里设置图例的绝对位置legend.position  = c(0.88 , .165),# legend.direction 设置图例的方向 horizontal 表示水平摆放legend.direction = "horizontal",# legend.background 设置图例的背景legend.background = element_blank())gg

6.2 利用 choroplethr 绘制地图热图

# 选择此次绘图所需要的列, 并重命名
de_commute <- df_input %>%select(CensusId, MeanCommute) %>%rename(region = CensusId, value = MeanCommute)# PS: 方便讲解, 我这里进行了拆解, 具体使用时可以组合在一起
# 创建一个州县级别的的 chorpleth 对象
choro <- CountyChoropleth$new(de_commute)
# 主标题
choro$title <- "2015年 - 全美通勤通勤时间"
# scale_fill_brewer() 一般用于箱线图和条形图等需要填充图的配色
choro$ggplot_scale <- scale_fill_brewer(name = "通勤时间(分钟)", palette = 3, drop = FALSE)
# 绘制图片, 或者交接给 ggplot2 进行进一步设置
hh <- choro$render()
# theme_minimal() 去坐标轴边框的最小化主题
hh <- hh + theme_minimal()
# labs() 对图形添加注释和标签(包含标题 title、子标题 subtitle、坐标轴 x & y 和引用 caption 等注释)
hh <- hh + labs(x = NULL, y = NULL, title = '2015年 - 全美通勤通勤时间',caption = '数据来源: 2015年美国人口普查数据 | GRAPH: 数绘小站')
# theme() 实现对非数据元素的调整, 对结果进行进一步渲染, 使之更加美观
hh <- hh + theme(# panel.grid.major 主网格线panel.grid.major = element_line(colour = "#333333", size = 0.25),# plot.background 图片背景plot.background = element_rect(color = '#F5F5DC', fill = '#F5F5DC', size = 2),# plot.margin 调整图像边距, 上-右-下-左plot.margin = unit(c(.15, .1, .15, 0.1), "cm"),# plot.title 主标题plot.title = element_text(color = "black", size = 24, face = "bold", vjust = -0.5, family = 'zxw'),# axis.text 坐标轴刻度文本axis.text = element_text(size = 16, face = "bold"),# legend.position 设置图例位置, 这里设置图例的绝对位置legend.position  = c(0.922 , .245),# legend.direction 设置图例的方向 vertical 表示垂直摆放legend.direction = "vertical",# legend.background 设置图例的背景, 背景为白色, 且图例边框无legend.background = element_rect(fill='white', colour = 'transparent'))hh

6.3 利用 statebins 绘制交互式六边形网格地图/蜂窝地图

# state.name 美国各个州的名字全称
# state.abb 美国各个州的名字缩写
df_state <- tibble(State = state.name) %>%bind_cols(tibble(ST = state.abb)) %>% # 新增两行数据bind_rows(tibble(State = "District of Columbia", ST = "DC")) %>%bind_rows(tibble(State = "Puerto Rico", ST = "PR"))# 整理绘图数据, 合并州名, 便于绘制地图
df_plot <- df_input %>%# group_by() 以指定的列进行分组group_by(State) %>%# 对 Hispanic 至 Pacific 列之间的数据进行操作mutate_at(vars(Hispanic : Pacific), funs(. * TotalPop / 100)) %>%# 对 TotalPop 至 Pacific 列之间的数据进行操作, 求和summarise_at(vars(TotalPop : Pacific), sum, na.rm = TRUE) %>%group_by(State) %>%mutate_at(vars(Men : Pacific), funs(round(. / TotalPop * 100, 3))) %>%# 合并州名left_join(df_state, by = 'State') %>%# gather() 数据收缩、从宽表到长表. key 将原数据框中所有的列赋值给这个变量; value 将原数据框中所有的值赋值给这个变量gather(TotalPop:Pacific, key = "facet", value = "share") %>% # 剔除 ST == PR 的数据filter(ST != "PR")# statebin() 用于创建交互式状态箱地图
# statebins 包只能绘制美国的地图
ii <- statebin(data = df_plot,x = "ST",y = "share",facet = "facet",heading =  "<b>美国国家人口普查</b>",footer = "<small>数据来源: 2015年美国人口普查数据 | GRAPH: 数绘小站",colors = RColorBrewer::brewer.pal(5, 'PuRd'),control = 'dropdown')ii

注:这是一个动态查询表格,这里不好展示,就截了一个图~

6.4 利用 ggplot2 绘制六边形网格地图/蜂窝地图

# 整理绘图数据
# 将名字中的 United States 部分剔除, 只保留州的名字
df_sp@data <- df_sp@data %>% mutate(name = gsub(" \\(United States\\)", "", google_name))
# 将数据转换成一个 tidy tibble
df_bert <- generics::tidy(df_sp, region = "name")
# 获得美国各州经纬度数据和缩写名称, 用于地图文字标注
albert <- cbind.data.frame(data.frame(gCentroid(df_sp, byid = TRUE), id = df_sp@data$iso3166_2))
df_bert <- left_join(df_bert, df_input, by = c("id" = "State"))
# 划分 bin, 即热图的刻度
df_bert$bin <- cut(df_bert$MeanCommute,breaks = c(seq(10, 35, by = 5), Inf),labels = c(seq(10, 30, by = 5), "35+"),include.lowest = TRUE)# 自定义绘图配色版
palette <- rev(magma(8))[c(-1,-8)]# PS: 方便讲解, 我这里进行了拆解, 具体使用时可以组合在一起
jj <- ggplot()
# geom_polygon() 绘制的是多边形
jj <- jj + geom_polygon(data = df_bert, aes(fill = bin, x = long, y = lat, group = group))
# geom_text() 添加文本信息, 将美国各州的缩写根据经纬度坐标添加到图片中
jj <- jj + geom_text(data = albert, aes(x = x, y = y, label = id), color = "#F8F8FF", size = 4.2, alpha = 0.72, family =  "gochi")
# scale_fill_manual() 采取的是手动赋值的方法, 也就是直接把颜色序列赋值给它的参数 value
jj <- jj + scale_fill_manual(values = palette, name="通勤时间(分钟)", guide = guide_legend(keyheight = unit(3.5, units = "mm"), keywidth=unit(14, units = "mm"), label.position = "top", title.position = 'bottom', nrow = 1))
# coord_map() 坐标系转换成地理坐标系
jj <- jj + coord_map()
# theme_minimal() 去坐标轴边框的最小化主题
jj <- jj + theme_minimal()
# labs() 对图形添加注释和标签(包含标题 title、子标题 subtitle、坐标轴 x & y 和引用 caption 等注释)
jj <- jj + labs(x = NULL, y = NULL, title = '2015年 - 全美通勤通勤时间',caption = '数据来源: 2015年美国人口普查数据 | GRAPH: 数绘小站')
# theme() 实现对非数据元素的调整, 对结果进行进一步渲染, 使之更加美观
jj <- jj + theme(# panel.grid.major 主网格线panel.grid.major = element_line(colour = "#333333", size = 0.25),# plot.margin 调整图像边距, 上-右-下-左plot.margin = unit(c(.15, .1, .15, 0.1), "cm"),# text 设置文本格式text = element_text(color = "red", size = 12, face = "bold", family = 'zxw'),# plot.title 主标题plot.title = element_text(color = "black", size = 24, face = "bold", vjust = -0.5, family = 'zxw'),# axis.text 坐标轴刻度文本axis.text = element_text(size = 16, face = "bold"),# legend.position 设置图例位置, 这里设置图例的绝对位置legend.position  = c(0.522 , .875),# legend.direction 设置图例的方向 vertical 表示垂直摆放legend.direction = "vertical",# legend.background 设置图例的背景, 这里设置图例无背景色, 无边框legend.background = element_blank(),# plot.background 图片背景plot.background = element_rect(color = '#DDA0DD', fill = '#DDA0DD', size = 2))jj

7. 保存图片到 PDF 和 PNG

filename = '20180430-A-01'
ggsave(gg, filename = paste0(filename, ".pdf"), width = 10.2, height = 6.3, device = cairo_pdf)
ggsave(gg, filename = paste0(filename, ".png"), width = 10.2, height = 6.3, dpi = 100, device = "png", bg = 'white')filename = '20180430-A-02'
ggsave(hh, filename = paste0(filename, ".pdf"), width = 10.2, height = 6.3, device = cairo_pdf)
ggsave(hh, filename = paste0(filename, ".png"), width = 10.2, height = 6.3, dpi = 100, device = "png")filename = '20180430-A-04'
ggsave(jj, filename = paste0(filename, ".pdf"), width = 10.2, height = 6.3, device = cairo_pdf)
ggsave(jj, filename = paste0(filename, ".png"), width = 10.2, height = 6.3, dpi = 100, device = "png")

8. session-info

sessionInfo()
## R version 4.2.1 (2022-06-23)
## Platform: x86_64-pc-linux-gnu (64-bit)
## Running under: Ubuntu 20.04.5 LTS
##
## Matrix products: albert
## BLAS:   /usr/lib/x86_64-linux-gnu/openblas-pthread/libblas.so.3
## LAPACK: /usr/lib/x86_64-linux-gnu/openblas-pthread/liblapack.so.3
##
## locale:
##  [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C
##  [3] LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8
##  [5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8
##  [7] LC_PAPER=en_US.UTF-8       LC_NAME=C
##  [9] LC_ADDRESS=C               LC_TELEPHONE=C
## [11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C
##
## attached base packages:
## [1] stats     graphics  grDevices utils     datasets  methods   base
##
## other attached packages:
##  [1] showtext_0.9-5        showtextdb_3.0        sysfonts_0.8.8
##  [4] statebins_1.4.0       rcstatebin_0.2        viridis_0.6.2
##  [7] viridisLite_0.4.1     rgeos_0.5-9           sp_1.5-0
## [10] broom_1.0.1           geojsonio_0.10.0      choroplethrMaps_1.0.1
## [13] choroplethr_3.7.1     acs_2.1.4             XML_3.99-0.10
## [16] plotly_4.10.0         forcats_0.5.2         stringr_1.4.1
## [19] dplyr_1.0.10          purrr_0.3.4           readr_2.1.2
## [22] tidyr_1.2.1           tibble_3.1.8          tidyverse_1.3.2
## [25] albersusa_0.4.1       maps_3.4.0            Hmisc_4.7-1
## [28] ggplot2_3.3.6         Formula_1.2-4         survival_3.4-0
## [31] lattice_0.20-45
##
## loaded via a namespace (and not attached):
##   [1] googledrive_2.0.0      WDI_2.7.8              colorspace_2.0-3
##   [4] rjson_0.2.21           deldir_1.0-6           ellipsis_0.3.2
##   [7] class_7.3-20           rgdal_1.5-32           htmlTable_2.4.1
##  [10] base64enc_0.1-3        fs_1.5.2               httpcode_0.3.0
##  [13] rstudioapi_0.14        proxy_0.4-27           farver_2.1.1
##  [16] fansi_1.0.3            lubridate_1.8.0        xml2_1.3.3
##  [19] splines_4.2.1          cachem_1.0.6           knitr_1.40
##  [22] jsonlite_1.8.2         cluster_2.1.4          dbplyr_2.2.1
##  [25] png_0.1-7              mapproj_1.2.8          compiler_4.2.1
##  [28] httr_1.4.4             backports_1.4.1        assertthat_0.2.1
##  [31] Matrix_1.5-1           fastmap_1.1.0          lazyeval_0.2.2
##  [34] gargle_1.2.1           cli_3.4.1              htmltools_0.5.3
##  [37] tools_4.2.1            ggmap_3.0.0            gtable_0.3.1
##  [40] glue_1.6.2             geojson_0.3.4          rappdirs_0.3.3
##  [43] V8_4.2.1               Rcpp_1.0.9             cellranger_1.1.0
##  [46] jquerylib_0.1.4        vctrs_0.4.2            crul_1.3
##  [49] tigris_1.6.1           xfun_0.32              rvest_1.0.3
##  [52] lifecycle_1.0.3        googlesheets4_1.0.1    jqr_1.2.3
##  [55] scales_1.2.1           ragg_1.2.3             hms_1.1.2
##  [58] RColorBrewer_1.1-3     curl_4.3.2             yaml_2.3.5
##  [61] gridExtra_2.3          sass_0.4.2             rpart_4.1.16
##  [64] latticeExtra_0.6-30    stringi_1.7.8          highr_0.9
##  [67] maptools_1.1-4         e1071_1.7-11           checkmate_2.1.0
##  [70] systemfonts_1.0.4      RgoogleMaps_1.4.5.3    rlang_1.0.6
##  [73] pkgconfig_2.0.3        bitops_1.0-7           evaluate_0.16
##  [76] sf_1.0-8               labeling_0.4.2         htmlwidgets_1.5.4.9000
##  [79] tidyselect_1.1.2       geojsonsf_2.0.3        plyr_1.8.7
##  [82] magrittr_2.0.3         R6_2.5.1               generics_0.1.3
##  [85] DBI_1.1.3              pillar_1.8.1           haven_2.5.1
##  [88] foreign_0.8-82         withr_2.5.0            units_0.8-0
##  [91] nnet_7.3-17            modelr_0.1.9           crayon_1.5.1
##  [94] tidycensus_1.2.3       uuid_1.1-0             interp_1.1-3
##  [97] KernSmooth_2.23-20     utf8_1.2.2             tzdb_0.3.0
## [100] rmarkdown_2.16         jpeg_0.1-9             grid_4.2.1
## [103] readxl_1.4.1           data.table_1.14.2      reprex_2.0.2
## [106] digest_0.6.29          classInt_0.4-8         textshaping_0.3.6
## [109] munsell_0.5.0          bslib_0.4.0

测试数据

配套数据下载:week5_acs2015_county_data.csv

20180430-A · ACS Census Data (2015) · ggplot2 maps rcstatebin 地图 热图 蜂窝地图 动态图 · R 语言数据可视化 案例 源码相关推荐

  1. 20180402-D · US Tuition Costs · ggplot2 geofacet 按地理位置分面的数据可视化 · R 语言数据可视化 案例 源码

    所有作品合集传送门: Tidy Tuesday 2018 年合集传送门: 2018 US Tuition Costs Average Tuition and Educational Attainmen ...

  2. 20180710-A · Craft Beer USA · ggplot2 geom_col 条形图 facet_geo theme 字体设置 画图 图例 · R 语言数据可视化 案例 源码

    所有作品合集传送门: Tidy Tuesday 2018 年合集传送门: 2018 Craft Beer USA 欢迎来到ggplot2的世界! ggplot2是一个用来绘制统计图形的 R 软件包.它 ...

  3. 20180416-H · Global Mortality · ggplot2 地图 gganimate 动图 动态地图 · R 语言数据可视化 案例 源码

    所有作品合集传送门: Tidy Tuesday 2018 年合集传送门: 2018 Global Mortality What do people die from? 在过去的几个世纪里,世界发生了很 ...

  4. 20180409-B · NFL Positional Salaries · ggplot2, 峦峰图, gganimate 动态图 · R 语言数据可视化 案例 源码

    所有作品合集传送门: Tidy Tuesday 2018 年合集传送门: 2018 NFL Positional Salaries NFL Positional Salaries Tidy Tuesd ...

  5. 20180402-A · US Tuition Costs · ggplot2, 折线图 · R 语言数据可视化 案例 源码

    所有作品合集传送门: Tidy Tuesday 2018 年合集传送门: 2018 US Tuition Costs Average Tuition and Educational Attainmen ...

  6. 20180402-E · US Tuition Costs · ggplot2, 地图 热力图 gganimate 动图 · R 语言数据可视化 案例 源码

    所有作品合集传送门: Tidy Tuesday 2018 年合集传送门: 2018 US Tuition Costs Average Tuition and Educational Attainmen ...

  7. 20180507-A · Global Coffee Chains · ggplot2 usmap geom_map geom_point 地图 热图 美国地图 · R 语言数据可视化 案例 源码

    所有作品合集传送门: Tidy Tuesday 2018 年合集传送门: 2018 Global Coffee Chains 欢迎来到ggplot2的世界! ggplot2是一个用来绘制统计图形的 R ...

  8. 20180416-F · Global Mortality · ggplot2 地图 热力图 条形图 · R 语言数据可视化 案例 源码

    所有作品合集传送门: Tidy Tuesday 2018 年合集传送门: 2018 Global Mortality What do people die from? 在过去的几个世纪里,世界发生了很 ...

  9. 20180529-A · Comic book characters · ggplot2 geom_bar geom_text 柱状图 条形图 图例 · R 语言数据可视化 案例 源码

    所有作品合集传送门: Tidy Tuesday 2018 年合集传送门: 2018 Comic book characters 欢迎来到ggplot2的世界! ggplot2是一个用来绘制统计图形的 ...

最新文章

  1. WEB浏览器兼容(转)
  2. 阿里云 ECS centos java timer进程异常/混乱......的解决方法
  3. C#中的深复制与浅复制
  4. 华为交换机的配置及:access、trunk、hybird端口详解
  5. QT-在子控件上绘图的两种方式
  6. 初级黑客安全技术命令详解
  7. 互联网公司忽悠员工的黑话,套路太深了。
  8. linux 安装apache resin,Linux下安装resin+apache+jdk+php+mysql(gd)全过程(二)
  9. 规则绝对公平时,社会财富的流向谁?
  10. java根据坐标轴_java 根据坐标截取图片实例代码
  11. python 串口接收多线程与界面通信_Python之PyQT多线程串口代码分析
  12. STM32 DCMI OV9655 直接在LCD显示
  13. 秒杀活动,怎么设计全套技术方案
  14. 【360校招笔试】第一题:计算表面积
  15. 一.数组(10)274. H 指数(不怎么理解)
  16. 3d Max人物动画学习笔记(一) 骨骼创建
  17. PX4使用FPV DShot电调
  18. 图片asp木马的制作方法[转]
  19. 初生牛犊:Windows下Anti-sandboxes技术探究
  20. 设计一个采购、销售和客户管理应用数据库

热门文章

  1. 为什么学习帕拉卡3D动画编程要从搭建开始?
  2. android 8 音质,体验中国好音质 8款HiFi音质手机推荐
  3. 用java打印一个圆形
  4. 【Kotlin】Kotlin 教程
  5. 大数据专题(一)- 简介
  6. Multisim 自定义元件库:创建-使用-仿真
  7. 递推最小二乘法RLS公式详细推导
  8. ubuntu node安装过程
  9. 计算机视觉方向面试题总结(二):图像分割篇
  10. findbugs错误类型对照表