How can Tracking leverage data visualization tools to communicate key messages to drive public health actions?
- RStudio - ggplot, plotly
- RMarkdown - flexdashboard
- RShiny - shinydashboard
- ArcGIS StoryMaps
1/16/2020
How can Tracking leverage data visualization tools to communicate key messages to drive public health actions?
# workspace
library(tidyverse)
library(tidycensus)
library(viridis)
library(tigris)
library(gganimate)
options(tigris_use_cache = TRUE)
# import
data <- read_csv("./Static Maps and GIFs_EP/ExtremeHeatProjections_A2_90__Full.csv")
# wrangle
EH <- data %>%
mutate(GEOID = as.character(countyFIPS)) %>%
select(everything(), -c(stateFIPS, countyFIPS))
EH$GEOID <- ifelse(nchar(EH$GEOID) <5,
paste("0", EH$GEOID, sep=""), EH$GEOID)
#glimpse(EH)
county_pop <-
get_acs(geography = "county",
variables = "B01003_001", # total population
year = 2016, # 2010 decennial census
geometry = TRUE, # load TIGER shapefiles
keep_geo_vars = TRUE,
shift_geo = TRUE) %>% #shifts AK and HI
rename(pop = estimate)
geo <- county_pop %>%
select(GEOID, geometry) #remove extra variables
EH_geo <- inner_join(geo, EH, by = 'GEOID')
GA <- EH_geo %>%
filter(State == "Georgia" & Year == 2030)
g <- ggplot(GA, aes(fill = as.integer(Value))) +
geom_sf() +
theme_minimal() +
scale_fill_viridis() +
coord_sf(datum = NA) +
labs(title = "Title1",
caption = "Caption1",
fill = "Extreme heat days")
g
d <- c(2020, 2030, 2040, 2050, 2060, 2070, 2080)
GA_d <- EH_geo %>%
filter(State == "Georgia" & Year %in% d)
GAmap_d <- ggplot(GA_d, aes(fill = as.integer(Value))) +
geom_sf() +
scale_fill_viridis_c() + scale_color_viridis_c() +
theme_minimal() + coord_sf(datum = NA) +
labs(title = "Title1", caption = "Caption1",
fill = "Extreme heat days") +
transition_states(Year,
transition_length = 3,
state_length = 10) +
ease_aes('linear')
animate(GAmap_d)
#anim_save("GAmap_decade.gif", animation = GAmap_d)
# workspace
library(tidyverse)
library(ggplot2)
library(viridis)
library(gganimate)
library(gifski)
library(png)
# import
EH <- read_csv("./Static Maps and GIFs_EP/ExtremeHeatProjections_A2_90__Full.csv")
GA <- EH %>%
filter(State == "Georgia" &
County %in% c("Bartow", "Cherokee",
"Forsyth", "Cobb",
"Fulton", "Gwinnett",
"Dekalb", "Rockdale",
"Clayton", "Douglas") &
!is.na(Value))
#summary(GA)
g <- ggplot(GA, aes(x = as.factor(County),
y = Value, fill = County)) +
geom_col()+ coord_flip()+
theme(legend.position = "none") +
labs(title = "Some Title",
caption = "Some Caption",
x = "", y = "Extreme Heat Days") +
transition_states(Year,
transition_length = 1,
state_length = 1) +
ease_aes('linear')+scale_fill_viridis_d() +
geom_text(aes(y=Value, label=Value, hjust=0))
#anim_save("GA_EHdays_2020-2030.gif", animation = g)