Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I remove border lines when using geom_sf? [closed]

Tags:

I tried doing the following:

ggplot(geography) + geom_sf(aes(fill=rate, color = NULL)) 

but that didn't get rid of the border lines.

like image 431
Sam Avatar asked Dec 08 '17 18:12

Sam


1 Answers

Without a reproducible example it is difficult to know exactly what you are looking for. However, I will take a guess that your are looking for a way to suppress the lines marking boundaries between different polygons (regions), e.g., suppress the lines showing country borders on a map of the world. If that is so then here is a solution.

Use lwd = 0 in the geom_sf call.

Example (you might need to download the developmental version of ggplot2)

# devtools::install_github("tidyverse/ggplot2") library(ggplot2) library(maps)  library(maptools) library(rgeos) library(sf)  world1 <- sf::st_as_sf(map('world', plot = FALSE, fill = TRUE))  with_boundary <-   ggplot() +     geom_sf(data = world1, mapping = aes(fill = ID)) +   theme(legend.position = "none") +   ggtitle("With Country Boundaries")  without_boundary <-   ggplot() +     geom_sf(data = world1, mapping = aes(fill = ID), lwd = 0) +   theme(legend.position = "none") +   ggtitle("Without Country Boundaries") 

enter image description here

like image 142
Peter Avatar answered Sep 28 '22 09:09

Peter