I'm trying to make two multiples of germany with no frames around the maps - this I managed to do. However, each multiple should have a label and I can't figure out how to control the frame around the panel labels.
Is there any way to control the label frames or do I have to switch to ggplot for that?
library(sp)
library(tmap)
library(RColorBrewer)
ID <- 1:16
Anzahl <- sample(10:80, 16)
AnzahlVF <- sample(50:200, 16)
Arbeitsort <- as.data.frame(cbind(ID, Anzahl, AnzahlVF))
Arbeitsort$relAnzahl <- Arbeitsort$Anzahl / sum(Arbeitsort$Anzahl)
Arbeitsort$relAnzahlVF <- Arbeitsort$AnzahlVF / sum(Arbeitsort$AnzahlVF)
ger <- sp::merge(x = germany, y=Arbeitsort, by.x = "ID_1", by.y = "ID")
pal <- brewer.pal(8, "Purples")
tm_shape(ger)+
tm_polygons(c("relAnzahl", "relAnzahlVF"), title = "students",
palette = pal)+
tm_layout(panel.labels = c("1. Map", "2. Map"),
panel.label.bg.color = NA,
legend.format = list(text.separator = "bis"),
legend.outside = T,
frame = F)+
tm_legend(position = c("left", "top"))
So if I understand correctly, you would like to disable the panel label borders? There is no option for that yet. In your case there are two tweaks:
1 You can use the title argument instead of panel.labels
, but this only works when the legend is placed inside the map. So the tweak is to use disable the legend, and draw the legend separately with tm_layout(legend.only = TRUE)
.
2 You can use tm_credits(c("1. Map", "2. Map"), position = c("center", "top"))
, but then you'll have to increase the 3rd value of the inner.margins (tm_layout).
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.