tmap 将 tm_fill 标题集中在图例上方

问题描述 投票:0回答:1

我需要将标题置于图例上方的中心。我尝试了很多

tm_layout
的标题X图例参数组合,但没有成功。

我正在使用tmap 3.3.4

我的最后一个代码:

ce_map <- tm_shape(shp_setor) +
  tm_fill(
    "v0001"
    , palette = "viridis"
    , title = "População do Ceará" 
    , legend.is.portrait = F
    , breaks = quebras
    , labels = labels 
  ) +
  tm_layout(
    legend.position = c("center","bottom")
    , legend.stack = "horizontal"
    , title.position = c("center","bottom")
    , legend.just = "center"
    , legend.width = 1
    , legend.title.size = 1.6
    , inner.margins = c(.14, .02, .02, .02)
    , bg.color = cor
    , frame = F
  )

你有什么想法吗?

r tmap
1个回答
0
投票

您的标题位置错误

ce_map <- tm_shape(shp_setor) +
  tm_fill(
    "v0001"
    , palette = "viridis"
    , title = "População do Ceará"
    , title.position = c("center","bottom") # <-------
    , legend.is.portrait = F
    , breaks = quebras
    , labels = labels 
  ) +
  tm_layout(
    legend.position = c("center","bottom")
    , legend.stack = "horizontal"
    , legend.just = "center"
    , legend.width = 1
    , legend.title.size = 1.6
    , inner.margins = c(.14, .02, .02, .02)
    , bg.color = cor
    , frame = F
  )
© www.soinside.com 2019 - 2024. All rights reserved.