tmap
tmap copied to clipboard
tm_scalebar bg.color argument does not work
library(tmap)
tmap_mode("plot")
#> tmap mode set to 'plot'
data(NLD_prov)
tm_shape(NLD_prov) +
tm_fill("name") +
tm_scalebar(bg.color = "black")
bg.color
is a standard argument for all map components (legends, compass, scalebar, etc). However, it only is used when there is a frame:
tm_shape(NLD_prov) +
tm_fill("name") +
tm_scalebar(bg.color = "gold", frame = T)
If you only want to replace the white bar in your scalebar example, you have to use color.light
:
tm_shape(NLD_prov) +
tm_fill("name") +
tm_scalebar(color.dark = "yellow", color.light = "purple", width = 0.8)
Would not it be better if the frame is automatically added when the bg.color is set? Currently, a user can specify the bg.color, but nothing happens...