Skip to content
This repository was archived by the owner on Jan 8, 2024. It is now read-only.

Commit b68ed2f

Browse files
author
Christopher Prener
committed
update map legends and code
1 parent d9bcbc1 commit b68ed2f

File tree

5 files changed

+8
-7
lines changed

5 files changed

+8
-7
lines changed

2016/results/povertyMap16-base.png

-4.09 KB
Loading

2016/results/povertyMap16-trans.png

-7.81 KB
Loading

2016/results/povertyMap16-white.png

-6.98 KB
Loading

2016/source/createMap.R

+3-7
Original file line numberDiff line numberDiff line change
@@ -40,20 +40,16 @@ moPoverty <- get_acs(geography = "county", state = "MO", output = "wide", table
4040
### subset columns and calculate estimate
4141
moPoverty %>%
4242
mutate(pctPoverty = (B17001_002E/B17001_001E)*100) %>%
43-
select(GEOID, B17001_001E, B17001_002E, pctPoverty) -> moPoverty
43+
select(GEOID, pctPoverty) %>%
44+
cp_breaks(var = pctPoverty, newvar = povertyJenks, classes = 5, style = "jenks") -> moPoverty
4445

4546
### combine spatial and geometric data
4647
povertyMap <- left_join(moCounties, moPoverty, by = "GEOID")
4748

48-
49-
jenks <- classIntervals(povertyMap$pctPoverty, n=5, style="jenks")
50-
poverty <- cut(povertyMap$pctPoverty, breaks = c(jenks$brks))
51-
52-
5349
## base map
5450
base <- ggplot() +
5551
geom_sf(data = mo, fill = "#ffffff", color = NA) +
56-
geom_sf(data = povertyMap, mapping = aes(fill = poverty), color = NA) +
52+
geom_sf(data = povertyMap, mapping = aes(fill = povertyJenks), color = NA) +
5753
geom_sf(data = mo, fill = NA, color = "#000000", size = .25) +
5854
scale_fill_brewer(palette = "BuGn", name = "Percent",
5955
labels = c("6.12 - 11.00", "11.01 - 15.70", "15.71 - 19.90", "19.91 - 24.20", "24.21 - 30.50")) +

NEWS.md

+5
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
# MO_DEMOS_countyPoverty v0.1.1
2+
3+
* Update code to use new `prener::cp_breaks` function
4+
* New breaks function removes the `NA` value from the legend
5+
16
# MO_DEMOS_countyPoverty v0.1.0
27

38
* Add map images for poverty rates by county in Missouri for 2016

0 commit comments

Comments
 (0)