There seem to be two sets of heights that need to be adjusted: the legend key heights and the overall legend height. Choosing cg from my verb, I extract the legend, make height adjustments, and then insert the legendary grob back into the layout.
leg = gtable_filter(cg, "guide-box") library(grid) # Legend keys leg[[1]][[1]][[1]][[1]]$heights = unit.c(rep(unit(0, "mm"), 3), rep(unit(1/4, "npc"), 4), unit(0, "mm")) # Legend leg[[1]][[1]]$heights[[3]] = sum(rep(unit(0, "mm"), 3), rep(unit(1/4, "npc"), 4), unit(0, "mm")) # grid.draw(leg) # Check that heights are correct cg.new = gtable_add_grob(cg, leg, t = 17, l = 8) grid.newpage() grid.draw(cg.new)

Sandy muspratt
source share