I am trying to arrange maps I created using tmap as shown below. I tried with the code below but didn't work.
photo showing preferred arrange
map_plpot <-tmap_arrange(NULL,plot_1,NULL,plot_2,plot_2,plot_3,nrow = 2,ncol= 3)
I am trying to arrange maps I created using tmap as shown below. I tried with the code below but didn't work.
photo showing preferred arrange
map_plpot <-tmap_arrange(NULL,plot_1,NULL,plot_2,plot_2,plot_3,nrow = 2,ncol= 3)
If you want a bit more of a tedious solution, you could use the grid
and gridExtra
packages. This will let you place each of the figures exactly where you want them, it just takes a bit of work to place them where you need them.
# 1. Open png file
png("plot_file.png", width = 20, height = 16, res = 300, units = "cm")
grid.newpage()
print(plot1, vp = viewport(0.5, 0.5) #x,y coordinates of the grid here
print(plot2, vp = viewport(0.1, 0.1) #x,y coordinates of the grid here
print(plot3, vp = viewport(0.3, 0.1) #x,y coordinates of the grid here
print(plot4, vp = viewport(0.5, 0.1) #x,y coordinates of the grid here
# 3. Close the file
dev.off()