自訂地圖輸出
你已經為舊金山灣區 Marin County 各 Census tract 的家庭中位房價等值區塊圖選好了合適的配色,接下來要來客製化輸出。在這個練習中,你會整理部分地圖元素,並加入一些描述性資訊,讓讀者更容易理解地圖的背景與脈絡。
本練習屬於課程
在 R 中分析美國人口普查資料
練習說明
- 將色彩導引設為 FALSE,以避免圖例被重複繪製。
- 為地圖加入具有說明性的副標題。
- 為地圖加入具有說明性的圖說。
動手互動練習
試著完成這個範例程式碼,體驗一下這個練習。
# Set the color guide to FALSE and add a subtitle and caption to your map
___(marin_value, ___(fill = estimate, color = ___)) +
___() +
scale_fill_viridis_c(labels = scales::dollar) +
scale_color_viridis_c(guide = ___) +
theme_minimal() +
coord_sf(crs = 26911, datum = NA) +
labs(title = "Median owner-occupied housing value by Census tract",
___ = "Marin County, California",
___ = "Data source: 2012-2016 ACS.\nData acquired with the R tidycensus package.",
fill = "ACS estimate")