r-tmap / tmap

R package for thematic maps
https://r-tmap.github.io/tmap
GNU General Public License v3.0
856 stars 119 forks source link

about tm_logo #723

Open kunzhang153 opened 1 year ago

kunzhang153 commented 1 year ago

Hello, does anyone know how to plot a logo outside the frame, for example in the lower left corner? I have tried tmap_arrange as below:

library(tmap)

data(World)
w1 <- qtm(World, projection = 3857)

tm <- tm_shape(World) + 
  tm_polygons(alpha = 0, border.alpha = 0) +
  tm_layout(frame = FALSE) +
  tm_logo("https://www.r-project.org/logo/Rlogo.png", height = 1, position = c("LEFT", "TOP")) 

current.mode <- tmap_mode("plot")
tmap_arrange(w1, tm, ncol = 1, heights = c(.85, .15))
tmap_mode(current.mode)

It looks like a success, but the map above is enlarged, and the width is not the width of the data.

mtennekes commented 1 year ago

With the current version, it is not easy. I can take a look but has very low priority. However, for tmap4 I plan to implement tm_logo, which should be easy. Then it is much easier to place it outside the frame.

olivroy commented 3 weeks ago

The code produces the following map with dev tmap (upcoming v4) image

The position doesn't seem to be respected?

mtennekes commented 2 weeks ago

If I set alpha to 1, this is the map:

image

And this is the map when heights = c(.15, .85)

image

Seems correct to me...