Sgt Cheddar
Sgt Cheddar

Reputation: 47

Remove / customize facets borders in tmap (tm_facets)

I created a plot with multiple facets, thanks to tmap (R package) and tm_facets.

I would like to remove the borders of the facets titles (i.e. the black rectangles on top of each map), but I can't figure out how.

Here is an example:

library(tmap)

data(World, NLD_muni, NLD_prov, land, metro)

current.mode <- tmap_mode("plot")

tm_shape(NLD_prov) +
  tm_polygons("gold2") +
  tm_facets(by="name")

Thanks in advance for any help.

Upvotes: 2

Views: 1669

Answers (2)

Kevin
Kevin

Reputation: 126

you can try yo use frame.lwd = NA and optional panel.label.bg.color = NA to remove the background colour in the facetbox

    library(tmap)

    data(World, NLD_muni, NLD_prov, land, metro)

    current.mode <- tmap_mode("plot")

    tm_shape(NLD_prov) +
      tm_polygons("gold2") +
      tm_facets(by="name") +
      tm_layout(frame = FALSE, frame.lwd = NA, panel.label.bg.color = NA)

Upvotes: 6

Orlando Sabogal
Orlando Sabogal

Reputation: 1638

You can set that parameter, and many others in the tm_layout() function. In this case just set the frame argument to be false

library(tmap)

data(World, NLD_muni, NLD_prov, land, metro)

current.mode <- tmap_mode("plot")

tm_shape(NLD_prov) +
  tm_polygons("gold2") +
  tm_facets(by="name") +
  tm_layout(frame = FALSE)

Upvotes: 0

Related Questions