我创建了一张显示犯罪数字的伦敦地图。正如你从下面的图片中看到的那样 - 我的传奇处于一个尴尬的地方 - 我更喜欢它在左下角还是右下角?任何人都知道我怎么可能这样做。我创建地图的代码如下。
另外,我如何为地图创建标题 - 我已经创建了图例标题。
qtm(brgh, fill = "Theft15", fill.title="Number of recorded thefts")
答案 0 :(得分:2)
由于我没有您的数据,我决定使用tmap
包中的数据进行以下演示。关键是使用tm_legend()
。如果您查看当前的CRAN手册,可以在tm_layout()
部分中找到更多信息。您可以使用legend.position
中的tm_legend()
指定图例的位置。对于主标题,您可以在函数中使用main.title
和main.title.position
。
library(tmap)
data(World, rivers, metro)
qtm(shp = World, fill = "economy", format = "World", style = "col_blind") +
tm_legend(legend.position = c("left", "top"),
main.title = "My title",
main.title.position = "right")
qtm(shp = World, fill = "economy", format = "World", style = "col_blind") +
tm_legend(legend.position = c("left", "bottom"),
main.title = "My title",
main.title.position = "right")