Created
June 18, 2016 20:16
-
-
Save andybega/8a0bbee9140665e412128523ba833cc7 to your computer and use it in GitHub Desktop.
This file contains 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
# Dot density map | |
# Eventually should be like http://www.radicalcartography.net/index.html?frenchkisses | |
library(maptools) | |
nc_SP <- readShapePoly(system.file("shapes/sids.shp", package="maptools")[1], | |
proj4string=CRS("+proj=longlat +ellps=clrk66")) | |
## Not run: | |
pls <- slot(nc_SP, "polygons") | |
pls_new <- lapply(pls, checkPolygonsHoles) | |
nc_SP <- SpatialPolygonsDataFrame(SpatialPolygons(pls_new, | |
proj4string=CRS(proj4string(nc_SP))), data=as(nc_SP, "data.frame")) | |
## End(Not run) | |
col1 <- dotsInPolys(nc_SP, as.integer(nc_SP$SID74)) | |
col2 <- dotsInPolys(nc_SP, as.integer(nc_SP$SID74/2)) | |
pt_size = 0.5 | |
plot(nc_SP, axes=TRUE) | |
points(col1, pch=19, col="red", cex = pt_size) | |
points(col2, pch=19, col="blue", cex = pt_size) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment