I am creating choropleth maps of county level data with ggplot2. I want to highlight multiple-county regions. It is simple enough to overlay a path or polygon of a subset of the county map data, but this leaves "interior" path lines. Is there a way to combine these regions into one group or simply hide the interior lines?
require(ggplot2)
require(maps)
require(maptools)
va <- map_data("county", region="virginia")
ggplot(va, aes(long, lat)) + coord_map() +
geom_polygon(aes(group=group)) +
geom_path(data=subset(va, subregion %in% c("patrick", "henry", "franklin",
"pittsylvania")), aes(group=group), size=1, color="white")
EDIT: The above example isn't exactly what I want to do. The code below is more representative of the actual project. The actual maps will be even more detailed than this since they use census tract level data and have geocoded points on top.
va <- map_data("county", region="virginia")
cty <- data.frame(subregion=unique(va$subregion))
cty$stat <- sample.int(nrow(cty))
va <- merge(va, cty, by="subregion")
p <- ggplot(va, aes(long, lat)) + coord_map() +
geom_polygon(aes(group=group, fill=stat), color="grey") +
geom_path(data=subset(va, subregion %in% c("patrick", "henry", "franklin",
"pittsylvania")), aes(group=group), size=1, color="white")


ahullfrom thealphahullpackage. the problem is that it includes points inside the region, even at high values of alpha.chullworks better in this regard but lacks the roughness ofahull. - attitude_stoolwith(subset(va, subregion %in% c("patrick", "henry", "franklin", "pittsylvania")), plot(long, lat))gives an other idea: identify and remove the points that are common between the subregions. - baptiste