小编sja*_*vie的帖子

tmap R - 将专题图标题的字体从普通字体更改为斜体,但保持图例的字体普通

我想使用R中的tmap包将专题图主标题的字体从“普通”更改为斜体,但保留图例标题和文本的字体“普通”。

但是,当我更改lm_layout()函数中的参数fontface时,它​​会更改地图中所有文本的字体。是否可以只更改 tmap 中主标题的字体?

我尝试的可重现示例(不幸的是,它将地图中所有文本的字体更改为斜体)如下:

library(tmap)
data("World")

tm_shape(World) +
tm_polygons("HPI", title = "World - HPI") +
  tm_layout(main.title = "HPI",
            main.title.position = "center",
            fontface = 3) 
Run Code Online (Sandbox Code Playgroud)

编辑: tmap 包的作者 Martijn Tennekes 向 tm_layout 添加了 10 个参数(因此也添加了 tmap 选项)以允许对此进行控制:(地图)标题、主标题、panel.label 的本地字体和字体系列,图例.标题和图例.文本。

tm <- tm_shape(World) +
tm_polygons(c("HPI", "economy"), title = c("Legend 1", "Legend 2")) +
tm_layout(main.title = "Main Title",
          main.title.position = "center",
          title = c("Title 1", "Title 2"),
          panel.labels = c("Panel 1", "Panel 2")) …
Run Code Online (Sandbox Code Playgroud)

r tmap

7
推荐指数
1
解决办法
2728
查看次数

标签 统计

r ×1

tmap ×1