I'm trying to draw map. Is there a way to write the name of the cities in bold within the map? ( i've found only the way to choose the size ). This is my script
right_join(prov2022, dataset, by = "COD_PROV") %>%
ggplot(aes(fill = `real wage`))+
geom_sf(data = ~ subset(., COD_REG == 7 | COD_REG >= 1 & COD_REG <= 3)) +
theme_void() +
theme(legend.title=element_blank())+
geom_sf_text(data = ~ subset(., COD_REG == 7 ), aes(label = city_name), size = 3) +
scale_fill_gradientn(colors = c( "#FFFFFF","#FFFF00", "#FF0000", "#000000")) +
geom_blank()
i'd like to have the city_name
in bold, but in geom_sf_text(data = ~ subset(., COD_REG == 7 ), aes(label = city_name), size = 3)
i cannot find the way to do it.... (increase the size is not a good option in my case bacause i've borders that not to be crossed)
You can simply use fontface = "bold"
in geom_sf_text
library(ggplot2)
ggplot(df) +
geom_sf(fill = "white") +
geom_sf_text(aes(label = lab), size = 5, fontface = "bold")
Reproducible example
library(sf)
df <- st_polygon(list(cbind(c(0, 1, 1, 0, 0), c(0, 0, 1, 1, 0)))) |>
st_sfc(crs = "WGS84") |>
st_as_sf() |>
within(lab <- "Bold text")