在tmap中对齐图例标题

时间:2020-02-17 17:21:05

标签: r tmap

是否可以将图例标题放在tmap中?利用tmap getting started vignette中的第一个示例:

library(tmap)
data("World")

tm_shape(World) +
  tm_polygons("HPI") 

收益

enter image description here

但我想要

enter image description here

我已经搜索过tm_layout的文档,但无法弄清楚如何对齐图例标题的文本。 legend.titletm_layout的唯一选项似乎是(1)legend.title.color,(2)legend.title.size,(3)legend.title.fontface和(4) legend.title.fontfamily,它们都不控制对齐方式。我缺少明显的东西吗?

1 个答案:

答案 0 :(得分:1)

好吧……显然没有一个参数可以控制图例标题的位置,您是否考虑过将其报告为问题?

一种解决方法可能是:

library(tmap)
data("World")

tm_shape(World) +
  tm_polygons("HPI", 
              title = "     HPI")

是的,我知道这看起来多么丑陋,但可以为您带来结果。

enter image description here

相关问题