简体   繁体   中英

R tmap: How to adjust the legend frame line width

I am trying to make a map with the cool tmap package and I cannot figure it out how to adjust the legend frame line width. I checked the impressive list of tm_layout arguments, but the closest I found was frame.lwd However,that refers to the frame of the map. I took the guess with legend.frame.lwd but that is not defined. Here is a toy example:

library(tmap)
data(Europe)

tm_shape(Europe) +
  tm_polygons("well_being", textNA="Non-European countries", title="Well-Being Index") +
  tm_text("iso_a3", size="AREA", root=5) +
  tm_layout(legend.position = c("RIGHT","TOP"),
            legend.frame = TRUE,
            frame.lwd = 5) # legend.frame.lwd does not exist

在此处输入图片说明

In the newer versions of tmap , the argument legend.frame.lwd was included with this commit . Here is an example, using tmap version 2.2:

library(tmap)
data("World")

tm_shape(World) +
  tm_polygons("HPI") +
  tm_layout(legend.frame = TRUE,
            frame.lwd = 5,
            legend.frame.lwd = 5)

在此处输入图片说明

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM