Yesterday, my good friend Ben tagged me in a tweet.

And so an idea was born.

Data: http://www.lawpd.com/DocumentCenter/View/3672/09-13-2018

Packages and Folders

# Install these packages if you don't have theme yet
# devtools::install_github("dkahle/ggmap", ref = "tidyup")
# install.packages("pacman")

pacman::p_load(tidyverse, pdftools, ggmap, gganimate)

Load Data

firedata <- tidytemplate::load_it("data/firedata.Rdata")

Static Map

lawrence <- c(left = -71.19, bottom = 42.68, right = -71.13, top = 42.72)
map <- get_stamenmap(lawrence, zoom = 14, maptype = "toner-lite")


firstmap <- ggmap(map) + # creates the map
  geom_point(aes(x = lon, y = lat, 
                 color = fire, shape = fire),                       # adding your data
             size = 2,
             data = firedata) +
  scale_shape_manual("Type", values= c(17, 4))+
  ggthemes::theme_map() +
  scale_colour_manual("Type", values = ggthemes::gdocs_pal()(2) %>% rev()) +
  labs(title = "911 Calls on 13th September 2018 in Lawrence, Massachusetts",
      caption = "Data Source: LAWPD\nFire Incidents: 84 out of 196 Total Incidents\n@FabioFavusMaxim; favstats.eu")  +
  theme(plot.title = element_text(size = 13, face = "bold"), 
    plot.caption = element_text(size = 8))
  
tidytemplate::ggsave_it(firstmap, width = 6, height = 6)