How much do data visualizations add to story telling?
A. Little BAM.
B. BAM!
C. Double BAM!!
D. Triple BAM!!!
(Psssss: BAMs are courtesy Josh Stramer)
To create Involuntary Shifts of Attention
Drive your point across impactfully
And sometimes, because it looks pretty
usa_population_map_multiyear <- plot_usa_population_map(data = population_dataset_lat_long %>% filter(Year %in% c(1910,2020)))
usa_population_map_animated <- usa_population_map_multiyear +
labs(subtitle = 'Year: {closest_state}') +
transition_states(Year) +
ease_aes('linear')
animate(usa_population_map_animated, duration =2, fps = 10, width = 900, height = 600, renderer = gifski_renderer())
Easily animate almost any plot
Make it part of your report or save as a gif
No interactivity to pause and play
Very slow rendering of gif
Cannot focus on only part of the plot
## Plotting function ----
# Select states to plot
state_selected <- c('California', 'Washington', 'Alabama', 'Pennsylvania')
data <- population_dataset_clean %>% filter(Name %in% state_selected)
## Convert to frames
data_med <- data %>%
arrange(Year, Name) %>%
split(.$Year) %>%
accumulate(~bind_rows(.x, .y)) %>%
bind_rows(.id = "frame") %>%
group_by(frame) %>%
arrange(Rank_Population_Density)
data_med %>%
plot_ly(x = ~Resident_Population_Density, y = ~Rank_Population_Density, color = ~Name,
hoverinfo = "text", text = ~paste0(Name,"\n",Year,"\n",Rank_Population_Density)) %>%
add_text(x = 250, y = 18, text = ~Year, frame = ~Year,
textfont = list(color = toRGB("gray80"), size = 40)) %>%
add_lines(frame = ~frame) %>%
add_markers(frame = ~frame) %>%
animation_opts(
frame = 1000,
transition = 0,
easing = "bounce"
) %>%
hide_legend()
Addition of interactivity
Much faster rendering for live reports
Can’t save as a gif and send it over
Requires frame creation