'Need to adjust the legend size and title position in tmap package of R?
I have produced the maps of spatRaster layers as shown in the top image. I want to increase the width of the legend by stretching it a bit longer horizontally (it should have a size similar/close to the combined size of the top three panels), so that the legend text representing rainfall values shows clearly with some space between the values. I also want to put the title of the legend on the left side of the legend.
Check out the bottom image that I scanned to get a good hint of the legend form I want to get.
I have used the code below to produce the maps.
tm_shape(stack) +
tm_raster(style = 'cont',
n=10,
palette= get_brewer_pal("RdYlBu", n=10, plot=FALSE),
title="Rainfall (mm)",
legend.is.portrait = FALSE) +
tm_shape(muda) +
tm_borders("black", lwd = 1) +
tm_layout(legend.outside = TRUE,
legend.stack = "horizontal",
legend.outside.position = "bottom",
legend.outside.size = 0.1,
legend.text.size = 1,
legend.title.size=1.5,
panel.labels = c("NN","IDW2", "IDW3", 'OK', "KED"))
Any ideas and suggestions please?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|


