Delete connecting lines in ggplot2 geom_polygon

I made the map below, multiplying the shapefile downloaded from www.gadm.org:

load(url('http://gadm.org/data/rda/GBR_adm0.RData')) library(ggplot2) ukMapFort <- fortify(gadm) ukMapFortSub <- subset(ukMapFort, lat > 55.575 & lat < 55.739 & long > -1.929 & long < -1.7) ggplot() + geom_polygon(data=data.frame(ukMapFortSub), aes(long, lat, group=id), fill=NA, color="black") 

enter image description here

How to remove two red lines? Note. I painted the lines in red using Photoshop - these lines are created using the R code, but not painted red with the R code.

+6
source share
1 answer

If you need to draw only borders, you can use geom_path() and the group column for group= . You should also add coord_map() in this case to maintain the correct aspect ratio between the x and y axis.

 ggplot(ukMapFortSub,aes(long, lat, group=group))+ geom_path(color="black")+coord_map() 

enter image description here

+9
source

Source: https://habr.com/ru/post/947553/


All Articles