Skip to content

Instantly share code, notes, and snippets.

@epijim
Created December 5, 2013 12:38
Show Gist options
  • Save epijim/7804530 to your computer and use it in GitHub Desktop.
Save epijim/7804530 to your computer and use it in GitHub Desktop.
mapping the police data
theme_bare <- theme(axis.line = element_blank(),
axis.text.x = element_blank(),
axis.text.y = element_blank(),
axis.ticks = element_blank(),
axis.title.x = element_blank(),
axis.title.y = element_blank(),
legend.position = "none")
cambridge <- get_map(location="Cambridge, UK", zoom=13, color="bw", source="osm")
CambridgeMap <- ggmap(cambridge, baselayer = ggplot(aes(x=Longitude, y=Latitude),
data=crime_data))
CambridgeMap + stat_density2d(aes( x=Longitude,y=Latitude,
fill=..level.. , alpha=..level.. ),
data=crime_data, bins=6 ,geom = "polygon" ) +
scale_fill_gradient(low = "red", high = "red") +
facet_wrap(~ Crime.type) + theme_bare
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment