I am making maps of the Region Hovedstaden in Denmark, which is the part that contains Copenhagen (København in the legend). The area is divided into "kommune"s that I want coloured differently. Alas, inside the Copenhagen kommune is an enclave - a different kommune - called Frederiksberg - which should thus be coloured differently from Copenhagen. But as seen from the map attached, it doesn't although the legend show the two kommunes with different colours. I presume this is because Frederiksberg is drawn/coloured first, then Copenhagen kommune is drawn above it. Surprisingly, though, the polygon outline is shown.
Plot code (which filters out some outlier islands):
ggplot(data = combmapscaled %>% filter(!(kommuner == "Christiansø" | (kommuner == "Halsnæs" & lat > 6220000)))) +
geom_polygon(aes(x = long,
y = lat,
fill = factor(kommuner),
group = group),
color = "white") +
coord_fixed(1)
Sample of "combmapscaled":
> head(combmapscaled)
long lat order hole piece id group kommuner V3 komcolours
1 726922.8 6179025 1 FALSE 1 30 30.1 København 1 1
2 726925.3 6179026 2 FALSE 1 30 30.1 København 1 1
3 726976.7 6179042 3 FALSE 1 30 30.1 København 1 1
4 726984.5 6179042 4 FALSE 1 30 30.1 København 1 1
5 726986.8 6179052 5 FALSE 1 30 30.1 København 1 1
6 727001.1 6179116 6 FALSE 1 30 30.1 København 1 1
Map:
Kommunes in the region, not quite coloured by kommune
So, a workaround, please... Draw Frederiksberg (again) over it all?
TIA, Jens