I am creating a map that consists out of 3 map panels. I have set the inner margins to zero in the tm_layout options for all maps, however depending on the dimensions of the output I still have empty white space inside the map frames.
I can reduce it to a minimum if I adjust the setting for width and height with tm_save but I want a clean solution.
I tried to creat a minimum example with the pre-installed tmap package data (though it is here less obvious that there is empty white space):
rm(list=ls(all=TRUE))
library(tmap)
data("NLD_prov")
map1 <- tm_shape(NLD_prov)+tm_fill()+tm_layout(inner.margins = c(0,0,0,0))
map2 <- tm_shape(NLD_prov)+tm_fill()+tm_layout(inner.margins = c(0,0,0,0))
final_map <-tmap_arrange(map1, map2)
final_map
In the original code I have cropped the input shape file to my desired map extent and also used a bounding box but that does not help:
map_extent<-st_bbox(c(xmin = 8, xmax = 9.1,ymin = 53.8, ymax = 55.1),
crs = st_crs(data))
data_cropped<-crop_shape(data, map_extent, polygon = TRUE)
tm_shape(data_cropped, bbox = map_extent)+
...
How can I force the margins to zero?