tmap icon indicating copy to clipboard operation
tmap copied to clipboard

Tmap_arrange multiple rows, size/aspect ratio by row

Open rmgriffin opened this issue 4 years ago • 2 comments

Thanks for this great package! I'm reviving this question from stackoverflow.

I was hoping with the new widths/lengths features it would be as simple as this, but no dice:

library(tmap)
library(spData)

a<-tm_shape(world) +
  tm_polygons(col = "lifeExp")

tmap_arrange(a,a,a, nrow = 2, widths=c(.5,.5,1))

# Or maybe a nested approach
b<-tmap_arrange(a,a)
tmap_arrange(b,a,nrow=2)

Is this not possible with tmap_arrange?

rmgriffin avatar Oct 20 '20 00:10 rmgriffin

Unfortunately, that is not possible yet. It would be good to have that functionality, but I don't know what the best way is to specify these 'merged' cells. From your suggestions, I prefer the nested approach, but there may be better ones.

mtennekes avatar Nov 23 '20 14:11 mtennekes

Hey,

maybe you can combine the tmap_arrange() with the ability to create layouts similar to the base plot. That would be a huge improvement because I sadly had to switch back to base blot for maps for a publication although tmap is much, much better!

Base R code would be like this:

x11()
mat <- matrix(
    c(  1,2,3,3,3,5,
        4,4,4,6,6,5,
        7,7,7,7,7,7),
    nrow = 3, 
    byrow = T)
layout(mat, widths = c(1,1,1,1,1,1,1), heights = c(1, 0.4,1))

layout.show(7)

All the best Louis

Pentaonia avatar Jul 19 '23 07:07 Pentaonia