Skip to content
Prev 256197 / 398506 Next

lattice: par.settings: custom axis.line by panel

On Fri, Apr 8, 2011 at 6:10 AM, Benjamin Tyner <btyner at gmail.com> wrote:
No.
Yes, but using the axis function would be better as panel function
clips by default (so technically only half of each line would be
visible).

xyplot(y ~ x|f,
       data = Data,
       layout=c(2,1),
       scales=list(relation="free",alternating=FALSE),
       par.settings = list(axis.line=list(col = "transparent")),
       axis = function(side, ...) {
           ## axis is called 4 times per panel; draw box only once
           if (side == "bottom")
           {
               box.lty <-
                   if (panel.number() %in% c(1)) # add others as needed
                       0
                   else
                       1
               grid::grid.rect(gp = grid::gpar(lty = box.lty))
           }
           axis.default(side = side, ...)
       })

-Deepayan