Remove border lines in ggplot map/choropleth

前端 未结 3 597
Happy的楠姐
Happy的楠姐 2021-02-05 14:14

I would like to remove the lines between regions of a choropleth generated in ggplot. My question is motivated by a very large map with very very small regions

3条回答
  •  谎友^
    谎友^ (楼主)
    2021-02-05 15:06

    Setting color = NA works for me:

    ggplot(tn, aes(x = long, y = lat, group = group)) + 
        geom_polygon(aes(fill = group), color = NA) +
        coord_map()
    

    produces this plot with no spaces between polygons.

    tn-map-no-borders

    I'm using ggplot2 version 1.0.0.

    I added coord_map to give it the right aspect ratio. On my machine, that doesn't affect the borders, I'm not sure why borders are visible in your second post. Here's mine:

    ggplot(tn, aes(x = long, y = lat, group = group)) + 
      geom_polygon(aes(fill = group), color = NA)
    

    enter image description here

提交回复
热议问题