tmap icon indicating copy to clipboard operation
tmap copied to clipboard

tm_scalebar bg.color argument does not work

Open Nowosad opened this issue 1 year ago • 2 comments

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")

Nowosad avatar Apr 26 '23 08:04 Nowosad

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)

image

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)

image

mtennekes avatar May 08 '23 14:05 mtennekes

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...

Nowosad avatar May 10 '23 12:05 Nowosad