Data from MassShootingTracker.org. There's not much to the code to generate it, but here it is:
library(tidyverse)
theme_set(theme_bw(14))
dd1 <- read_csv("/tmp/MST Data 2013 - 2015.csv")
dd2 <- read_csv("/tmp/MST Data 2014 - 2015.csv")
dd3 <- read_csv("/tmp/MST Data 2015 - 2015.csv")
dd4 <- read_csv("/tmp/Mass Shooting Data 2016 - 2016.csv")
dd5 <- read_csv("/tmp/Mass Shooting Data 2017 - 2017.csv")
dd6 <- read_csv("/tmp/Mass Shooting Data 2018 - 2018.csv")
dd <- rbind(dd1, dd2, dd3, dd4, dd5, dd6)
dd$year <- sapply(dd$date, function(x) as.numeric(strsplit(x, "/", fixed = TRUE)[[1]][3]))
dd$year <- ifelse(dd$year < 2000, dd$year + 2000, dd$year)
dd$ov <- 0
ggdata <- dd %>%
group_by(year) %>%
summarise(nkilled = sum(killed),
nwounded = sum(wounded),
znoverthrown = sum(ov)) %>%
gather(key, value, -year)
plt1 <- ggplot(ggdata) +
geom_line(aes(x = year, y = value, group = key, color = key)) +
geom_point(aes(x = year, y = value, color = key)) +
geom_text(data = ggdata %>% filter(key == "znoverthrown"),
aes(x = year, y = value, group = key, label = value), vjust = -0.7, nudge_x = 0) +
xlab("Year") +
ylab("Count") +
ggtitle("A Recent History of the Second Amendment",
subtitle = "Mass shootings in the US, 2013 - 2018. Data from MassShootingTracker.org. Partial data for 2018." ) +
scale_color_brewer(palette = "Set1", name = NULL,
labels = c("Dead", "Wounded",
"Tyrannical governments overthrown by a well regulated militia")) +
theme(legend.position = "top", legend.direction = "horizontal")
plot(plt1)