Geom_map borders in ggplot2

I am trying to create a choropleth map using geom_map in ggplot2. I want to highlight different areas of black or another color in order to distinguish areas that are similar in color to the gradient. Using the following code, I tried to set the color to highlight areas. The code creates a map, but without borders. When I move the color team into aesthetics, it creates the expected “pink” borders with the legend. Any ideas why setting the color won't create borders, but will the display be? I saw a similar discussion about the ggplot2 google group.

ggplot(subset(df, as.character(variable) == "value"), aes(map_id = id)) +
  geom_map(aes(fill = pct), colour = "black", map = ggmap) +
  expand_limits(x = ggmap$long, y = ggmap$lat) +
  scale_fill_gradient(low = "antiquewhite", high = "darkred") +
  opts(title = "Title", panel.background = theme_rect(fill = "grey90"))

thank

+2
source share
1 answer

, geom_polygon. XXXX (data) lat long (x y) . maps, , .

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"))
+4

All Articles