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"))
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?
I could able to add single compass and scale_bar by taking help from this post
library(tmap)
library(stars)
library(terra)
#Read some data
tif = system.file("tif/L7_ETMs.tif", package = "stars")
x = terra::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), attr.outside = T, attr.outside.position = "bottom", attr.just = "right",
legend.outside = T, legend.outside.position = "right",
legend.position = c("left", "top"),
legend.text.size = 0.8, legend.title.size = 0.9,
legend.format = list(digits = 2, text.separator = "-"))+
tm_compass(position = c("left", "top"))+
tm_scale_bar(text.size = 1, position = c("RIGHT", "top"))