I have a similar problem with @Mike in this question . The question is how to set the colors of the contours of the areas on the chart of the map.
The proposed solution is to add geom_polygonto build over the borders. This works as long as the entire area is built. When you try to limit the subzone, the polygons are weird (apparently because some vertices are removed). Using a standard example geom_map:
ids <- factor(c("1.1", "2.1", "1.2", "2.2", "1.3", "2.3"))
values <- data.frame(id = ids, value = c(3, 3.1, 3.1, 3.2, 3.15, 3.5))
positions <- data.frame(
id = rep(ids, each = 4),
x = c(2, 1, 1.1, 2.2, 1, 0, 0.3, 1.1, 2.2, 1.1, 1.2, 2.5, 1.1, 0.3, 0.5, 1.2, 2.5, 1.2, 1.3, 2.7, 1.2, 0.5, 0.6, 1.3),
y = c(-0.5, 0, 1, 0.5, 0, 0.5, 1.5, 1, 0.5, 1, 2.1, 1.7, 1, 1.5, 2.2, 2.1, 1.7, 2.1, 3.2, 2.8, 2.1, 2.2, 3.3, 3.2)
)
ggplot(values, aes(fill = value)) +
geom_map(aes(map_id = id), map = positions) +
geom_polygon(aes(x,y,group=id), fill = NA, colour = 'red', data = positions) +
expand_limits(positions) +
ylim(0, 3)
A possible workaround is to use the color aesthetics in geom_map, and then manually select the outline color using scale_colour_manualas follows:
ggplot(values, aes(fill = value)) +
geom_map(aes(map_id = id, colour = 'white'), map = positions) +
scale_colour_manual(values=c('white')) +
expand_limits(positions) +
ylim(0, 3)
I have two questions:
. .

