Please, consider the following example:
library(tmap)
data("World")
tm_shape(World) +
tm_polygons("HPI")
This gives me the following map:
My problem is the legend. The legend boxes that show the colors are squares that are directly next to each other. Is there a way to handle them so that they become rectangles with a spacing between them? Maybe something like this (it's a picture from a book to show the desired output - I can't provide code for this one):