# layout.torture()

    top.vp <- viewport(y = 0, height = unit(1, "npc") - unit(1.5, 
        "lines"), just = c("centre", "bottom"))
    do.label <- function(label) {
        grid.rect(y = 1, height = unit(1.5, "lines"), just = c("center", 
            "top"))
        grid.text(label, y = unit(1, "npc") - unit(1, "lines"), 
            gp = gpar(font = 2))
    }
    grid.show.layout(grid.layout(3, 2), vp = top.vp)
    do.label("All dimensions relative -- no respect")
    grid.show.layout(grid.layout(3, 2, respect = TRUE), vp = top.vp)
    do.label("All dimensions relative -- full respect")
    grid.show.layout(grid.layout(3, 2, respect = matrix(c(1, 
        0, 0, 0, 0, 0), 3L, 2L, TRUE)), vp = top.vp)
    do.label("All dimensions relative -- only top-left cell respected")
    grid.show.layout(grid.layout(3, 2, respect = matrix(c(1, 
        0, 0, 0, 0, 1), 3L, 2L, TRUE)), vp = top.vp)
    do.label("All relative -- top-left, bottom-right respected")
    grid.show.layout(grid.layout(2, 3, widths = unit(c(2, 4, 
        1), c("null", "cm", "null")), heights = unit(c(6, 4), 
        c("cm", "null"))), vp = top.vp)
    do.label("Absolute and relative -- no respect")
    grid.show.layout(grid.layout(2, 3, widths = unit(c(2, 4, 
        1), c("null", "cm", "null")), heights = unit(c(6, 4), 
        c("cm", "null")), respect = TRUE), vp = top.vp)
    do.label("Absolute and relative -- full respect")
    grid.show.layout(grid.layout(2, 3, widths = unit(c(2, 4, 
        1), c("null", "cm", "null")), heights = unit(c(6, 4), 
        c("cm", "null")), respect = matrix(c(0, 0, 0, 0, 0, 1), 
        2L, 3L, TRUE)), vp = top.vp)
    do.label("Absolute and relative -- bottom-right respected")
