如何修复美国地图中重叠的多边形?

How to fix overlaying polygons in US map?

下面给出了重叠的多边形,如何解决?

library(ggplot2)
ggplot(data = map_data("state")) + geom_polygon(aes(long, lat, group = region), 
  color = "red", fill = "red", alpha = 0.2)

你应该使用group = group作为geom_poly的参数,请看下面:

library(ggplot2)
ggplot(data = map_data("state")) + 
  geom_polygon(aes(long, lat, group = group), 
               color = "red", fill = "red", alpha = 0.2)

输出: