# NOT RUN {
library(sf)
data(domestic_violence)
# Map in geographic coordinates
ggplot(domestic_violence, aes(fill = Scaled)) +
geom_sf() +
scalebar(domestic_violence, dist = 4, dist_unit = "km",
transform = TRUE, model = "WGS84") +
blank() +
scale_fill_continuous(low = "#fff7ec", high = "#7F0000")
# Map in projected coordinates
domestic_violence2 <- st_transform(domestic_violence, 31983)
ggplot(domestic_violence2, aes(fill = Scaled)) +
geom_sf() +
scalebar(domestic_violence2, dist = 4, dist_unit = "km",
transform = FALSE, model = "WGS84") +
blank() +
scale_fill_continuous(low = "#fff7ec", high = "#7F0000")
# }
Run the code above in your browser using DataLab