I am trying to change the border colour on regions of and sf object when I plot it. Changing the colour of the border is fine, however, the lines are a bit thin so I want to make only the coloured lines thicker so they are more visible.
Reading this question suggests that using "lwd" will allow changes in thickness. However, when I try I either get no effect or extremly thick lines.
See the example below
library(sf)
library(ggplot)
library(dplyr)
nc <- st_read(system.file("shape/nc.shp", package="sf")) %>%
mutate(type= case_when(
BIR74>16000 ~"High",
TRUE ~"Low"
) %>% factor(levels = c("Low", "High"))) #the levels are ordered to avoid the grey lines overwriting the red ones
nc %>%
ggplot(.) +
geom_sf(aes(fill = BIR74, colour = type)) + #does the job but the coloured borders are quite thing
scale_color_manual(values = c( "#666666","#F8766D"))
nc %>%
ggplot(.) +
geom_sf(aes(fill = BIR74, colour = type,
lwd = ifelse(type =="High", 1, 0.5)) #The values can be anything and it still looks rubbish
) +
scale_color_manual(values = c( "#666666","#F8766D"))
How can I get only senible thicknesses like x% thicker? Ideally only the target edges will be changed.