[英]How to put title of a map outside of the panel (tmap package)
I'm plotting a simple map in R and I'm stuck with this problem: the title is overlapping the plot and I don't know how to put it outside of the panel.我在 R 中绘制了一个简单的 map 并且我遇到了这个问题:标题与 plot 重叠,我不知道如何将其放在面板之外。
With ggplot2 I can do this easily with plot.title.position
option in theme
function, since tmap works with the same logic, I think might be a way to do this. With ggplot2 I can do this easily with
plot.title.position
option in theme
function, since tmap works with the same logic, I think might be a way to do this.
Code and shapefile download :代码和shapefile 下载:
library(sf)
library(tmap)
brasil <- st_read("/shp/BRUFE250GC_SIR.shp")
tm_shape(brasil) +
tm_borders() +
tm_fill() +
tm_compass() +
tm_scale_bar() +
tm_layout(
title = "The quick brown fox jumps over the lazy dog"
)
Use tm_layout(main.title = "Main Title", main.title.position = "center")
in place of tm_layout(title = "The quick brown fox jumps over the lazy dog")
to have the title outside the map.使用
tm_layout(main.title = "Main Title", main.title.position = "center")
代替tm_layout(title = "The quick brown fox jumps over the lazy dog")
使标题位于 map 之外。
tm_shape(brasil) +
tm_borders() +
tm_fill() +
tm_compass() +
tm_scale_bar() +
tm_layout(
main.title = "The quick brown fox jumps over the lazy dog",
main.title.position = "center")
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.