Search code examples
rrgdaltmap

how to export tm object without chart borders


I am trying to plot a map without the 'box border' around it.

Does anybody know how to work around the tmap package to not print the 'outer box border'? - not to be confused with tm_borders as it is a segment plotting the border of the polygons in the map.

Here's my example code:

tm_obj <- tm_shape(area_spdf) + 
          tm_fill(col = var, palette = "Blues", legend.show = FALSE) +
          tm_borders(col = "burlywood4", lwd = 0.25)`

save_tmap(tm = tm_obj, 
          filename = paste("plot_tm_output_", var, ".png", sep = ""))`

enter image description here


Solution

  • You can use tm_layout to specify not to draw frame:

     tm_obj <- tm_shape(area_spdf) + 
               tm_fill(col = var, palette = "Blues", legend.show = FALSE) +
               tm_borders(col = "burlywood4", lwd = 0.25) +
               tm_layout(frame = FALSE)