How to add compass and scale_bar only once in tm_facets of tmap?

64 Views Asked by At

I want to add compass and scale_bar only once while using tm_facets. Here is an example code

library(tmap)
library(stars)
library(terra)

#Read some data
tif = system.file("tif/L7_ETMs.tif", package = "stars")
x = rast(tif)

#Plot it using tmap r package
tm_shape(x) +
  tm_raster(style="quantile")+
  tm_facets(nrow = 3) +
  tm_layout(panel.labels = names(x), 
            legend.outside=T, legend.outside.position = "right",
            legend.position= c("center", "center"),
            legend.text.size = 1,
            legend.format = list(digits = 2, text.separator = "-"))+
  tm_compass(position = c("RIGHT", "BOTTOM"))+
  tm_scale_bar(text.size = 1, position = c("RIGHT", "BOTTOM"))

Rplot

As you can see in the output, all the facets are having compass and scale_bar. How can I add compass and scale_bar in only one facet?

0

There are 0 best solutions below