.
This is is a mildly morbid vizualization, to map homicides in Washington DC, using color to visualize murder weapon. There is a lot more analysis that I haven’t yet portted to Rmd so for just this dark plot.
This data is was sourced from the DC Metropolitan Police Department’s ASAP Crime database. The data set I am using here contains only the record of homicides in the District of Columbia for the year 2013, with information about the type of weapon used, time of day, city block.
I have used the ggmap::geocode()
function to preprocess the data set and translate the dataset’s original city block information into lattitude and longitude coordinates for this visualization.
library(tidyverse)
library(leaflet)
library(RColorBrewer)
library(magrittr)
library(htmltools)
library(rgdal)
sub_crime <- readRDS("~/future/Capital_Crime/data/homicides.RDS")
offense_pal <- colorFactor(palette = c("#1B9E77", "#D95F02", "#7570B3"),
domain = NULL)
leaflet(sub_crime, options = leafletOptions(minZoom = 12, maxZoom = 14)) %>%
addProviderTiles("CartoDB.Positron") %>%
addCircleMarkers(color = ~offense_pal(METHOD), weight = 2, radius = 15,
opacity = .5, fillOpacity = .25) %>%
addLegend("topright", pal = offense_pal, values = ~METHOD,
title = "Murder Weapon")