Skip to content
Prev 178742 / 398506 Next

latticeExtra: useOuterStrips and axis.line$lwd

On Tue, Apr 28, 2009 at 7:40 AM, tyler <tyler.smith at mail.mcgill.ca> wrote:
Those are actually not axis lines, but the borders of the
0-width/height strips that still get drawn. Here's a modified
useOuterStrips() that doesn't draw the strips, which I'll include in
the next release (also, see below regarding lwd=0).

useOuterStrips <-
    function(x,
             strip = strip.default,
             strip.left = strip.custom(horizontal = FALSE),
             strip.lines = 1,
             strip.left.lines = strip.lines)
{
    dimx <- dim(x)
    stopifnot(inherits(x, "trellis"))
    stopifnot(length(dimx) == 2)
    opar <- if (is.null(x$par.settings)) list() else x$par.settings
    par.settings <-
        modifyList(opar,
                   list(layout.heights =
                        if (x$as.table) list(strip = c(strip.lines,
rep(0, dimx[2]-1)))
                        else list(strip = c(rep(0, dimx[2]-1), 1)),
                        layout.widths =
                        list(strip.left = c(strip.left.lines, rep(0,
dimx[1]-1)))))
    if (is.character(strip))
        strip <- get(strip)
    if (is.logical(strip) && strip)
        strip <- strip.default
    new.strip <-
        if (is.function(strip))
        {
            top.row <- if (x$as.table) 1 else nrow(trellis.currentLayout())
            function(which.given, which.panel, var.name, ...) {
                if (which.given == 1 && current.row() == top.row)
                    strip(which.given = 1,
                          which.panel = which.panel[1],
                          var.name = var.name[1],
                          ...)
            }
        }
        else strip
    if (is.character(strip.left))
        strip.left <- get(strip.left)
    if (is.logical(strip.left) && strip.left)
        strip.left <- strip.custom(horizontal = FALSE)
    new.strip.left <-
        if (is.function(strip.left))
        {
            function(which.given, which.panel, var.name, ...) {
                if (which.given == 2 && current.column() == 1)
                    strip.left(which.given = 1,
                               which.panel = which.panel[2],
                               var.name = var.name[2],
                               ...)
            }
        }
        else strip.left
    update(x,
           par.settings = par.settings,
           strip = new.strip,
           strip.left = new.strip.left,
           par.strip.text = list(lines = 0.5),
           layout = dimx)
}
You should use

my.trellis.pars$col = "transparent"

(lwd=0 is not what you think it is).

-Deepayan