I'm trying to create and save a map with transparent background instead of a white (or any other color) one using the R package tmap
.
Apart from what's in the example below, I tried using bg.color = "transparent"
, bg.color = NA
, and bg.color = NULL
in both tmap_options
and tm_layout
.
Version info:
tmap
: 2.2tmaptools
: 2.0-1
library(tmap)
data("World")
tmap_options (bg.color = "#00000000", basemaps.alpha = 0)
map <- tm_shape(World) +
tm_polygons("HPI") +
tm_layout (frame = FALSE, bg.color = "#00000000")
tmap_save (map, filename = "~/test.png")
Am I doing something wrong or is this simply a limitation of the package? Thanks a lot!