Created
May 19, 2022 15:00
-
-
Save walkerke/db2a2a90ec58918cd629ddd8e2bb689e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(tmap) | |
library(tidycensus) | |
options(tigris_use_cache = TRUE) | |
sf::sf_use_s2(FALSE) | |
tarrant_housing <- get_acs( | |
geography = "tract", | |
state = "TX", | |
county = "Tarrant", | |
variables = c( | |
`2014 or later` = "S2504_C01_009", | |
`2010-2013` = "S2504_C01_010", | |
`2000-2009` = "S2504_C01_011", | |
`1980-1999` = "S2504_C01_012", | |
`1960-1979` = "S2504_C01_013", | |
`1940-1959` = "S2504_C01_014", | |
`1939 or earlier` = "S2504_C01_015" | |
), | |
year = 2020, | |
geometry = TRUE | |
) | |
tarrant_dots <- as_dot_density( | |
tarrant_housing, | |
value = "estimate", | |
values_per_dot = 25, | |
group = "variable", | |
erase_water = TRUE, | |
area_threshold = 0.95 | |
) | |
tmap_mode("view") | |
tm_basemap(leaflet::providers$CartoDB.Positron) + | |
tm_shape(tarrant_dots) + | |
tm_dots(col = "variable", | |
border.lwd = 0, | |
palette = "viridis", | |
size = 0.01, | |
title = "1 dot = 25 housing units", | |
id = NULL) + | |
tm_view(dot.size.fixed = FALSE) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment