我目前正试图在同一张地图上显示不同变量的值。
以下是我的代码:
tm_shape(pv_malay_merge) +
tm_fill(col = "Exposure", n = 10, title = "Policyholders' Exposure",
palette = rev(brewer.pal(n = 4, "RdYlGn"))) +
tm_borders(lwd = 0.5) +
tm_text(text = "NAME_1", size = 0.5) +
tm_shape(malay_merge) +
tm_bubbles(size = "Exposure")
上面的代码导致:
之后我尝试将其更改为:
tm_shape(pv_malay_merge) +
tm_fill(col = "Exposure", n = 10, title = "Policyholders' Exposure",
palette = rev(brewer.pal(n = 4, "RdYlGn"))) +
tm_borders(lwd = 0.5) +
tm_text(text = c("NAME_1", "Exposure"), size = 1) +
tm_shape(malay_merge) +
tm_bubbles(size = "Exposure")
注意tm_text()
功能的变化。这导致:
关于组合地图的任何建议?
答案 0 :(得分:1)
一个组中不能有多个tm_text
图层,因此您需要两个图层组,例如:
tm_shape(pv_malay_merge) +
tm_text(text = "NAME_1", size = 0.5) +
tm_shape(pv_malay_merge) +
tm_text(text = "Exposure", size = 0.5)
为防止遮挡,您可以使用ymod
作为其中之一,如已建议的那样。
为什么气泡不可见?它们应该比文本标签imo更好地工作。