powered by
Convenience function for fortifying SpatialPolygonsDataFrames for ggplot2 plotting.
ggmapmerge(mapobj, xid)
Name of an S4 SpatialPolygonsDataFrame
Name of ID variable in the SpatialPolygonsDataFrame
An S3 dataframe suitable for using in a gggplot2 map
This function requires maptools to be loaded and gpclibPermit to be TRUE. This is because it depends on the fortify method in ggplot2.
gpclibPermit
TRUE
fortify
ggplot2
# NOT RUN { xx <- maptools::readShapePoly(system.file("shapes/sids.shp", package="maptools")[1], IDvar="FIPSNO") plotobj <- ggmapmerge(xx,"FIPS") # }
Run the code above in your browser using DataLab