Mapping demographic data with ggplot2

R ile ABD Nüfus Sayımı Verilerini Analiz Etme

Kyle Walker

Instructor

A basic choropleth map with geom_sf()

library(ggplot2)

ggplot(cook_value, aes(fill = estimate)) + 
  geom_sf()
R ile ABD Nüfus Sayımı Verilerini Analiz Etme

first cook county ggplot

R ile ABD Nüfus Sayımı Verilerini Analiz Etme

Modifying map colors

ggplot(cook_value, aes(fill = estimate, color = estimate)) + 
  geom_sf() + 
  scale_fill_viridis_c() +  
  scale_color_viridis_c()

cook county plot with viridis

R ile ABD Nüfus Sayımı Verilerini Analiz Etme

Customizing the map output

ggplot(cook_value, aes(fill = estimate, color = estimate)) + 
  geom_sf() + 
  scale_fill_viridis_c(labels = scales::dollar) +  
  scale_color_viridis_c(guide = FALSE) + 
  theme_minimal() + 
  coord_sf(crs = 26916, datum = NA) + 
  labs(title = "Median home value by Census tract", 
       subtitle = "Cook County, Illinois", 
       caption = "Data source: 2012-2016 ACS.\nData acquired with the R 
                  tidycensus package.", 
       fill = "ACS estimate")
R ile ABD Nüfus Sayımı Verilerini Analiz Etme

Formatted Cook County ggplot

R ile ABD Nüfus Sayımı Verilerini Analiz Etme

Let's practice!

R ile ABD Nüfus Sayımı Verilerini Analiz Etme

Preparing Video For Download...