I am trying to produce a choropleth map using geom_map in ggplot2. I want to outline the various regions in black or some other color to distinguish between areas that are simil
You need to add the polygon borders using geom_polygon. In the code below you need to fill in the XXXX
with a data set (data
) and lat and long (x
and y
) values for each polygon. I usually get my data from the maps
package, not sure if this is what you did.
ggplot(subset(df, as.character(variable) == "value"), aes(map_id = id)) +
geom_map(aes(fill = pct), colour = "black", map = ggmap) +
geom_polygon(data=XXXX, aes(x=XXXX, y=XXXX), colour='black', fill=NA) +
expand_limits(x = ggmap$long, y = ggmap$lat) +
scale_fill_gradient(low = "antiquewhite", high = "darkred") +
opts(title = "Title", panel.background = theme_rect(fill = "grey90"))