oswaldosantos/ggsn

Option to change number of labels from 3 to 2 in scalebar

Tom-Jenkins opened this issue · 0 comments

Hi Oswaldo, the scalebar function is great, but I was wondering if there is currently a way to change the number of labels (i.e. the number of scales), ideally from 3 to 2 whereby only "0" and the maximum scale is drawn. For example, on the map below only display 0 and 8km. This would be useful because sometimes in small scales the middle label isn't required and gets in the way.

Example

library(ggsn); library(ggplot2); library(sf)
data("domestic_violence")
(ggm1 <- ggplot(domestic_violence, aes(fill = Scaled)) +
geom_sf() +
scale_fill_continuous(low = "#fff7ec", high = "#7F0000"))
ggm1 + north(domestic_violence) + scalebar(domestic_violence, dist = 4, dist_unit = "km", transform = TRUE, model = "WGS84")

example_map