Created
August 7, 2016 00:09
-
-
Save andrewbtran/7f2ba081d5f96af182463f0521b8a3c3 to your computer and use it in GitHub Desktop.
Making another choropleth with an additional layer
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
townborders <- readOGR(dsn="shapes", layer="ctgeo") | |
townborders_only <- townborders | |
townborders<- fortify(townborders, region="NAME10") | |
# Subset the town borders to just Hamden since that's the department we're looking at | |
town_borders <- subset(townborders, id=="Hamden") | |
tm_ct <- ggplot() + | |
geom_polygon(data = total_map, aes(x=long, y=lat, group=group, fill=total), color = "black", size=0.2) + | |
geom_polygon(data = town_borders, aes(x=long, y=lat, group=group, fill=total), color = "black", fill=NA, size=0.5) + | |
coord_map() + | |
scale_fill_distiller(type="seq", trans="reverse", palette = "Reds", breaks=pretty_breaks(n=10)) + | |
theme_nothing(legend=TRUE) + | |
labs(title="Where Hamden police conduct traffic stops", fill="") | |
print(tm_ct) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment