Consider the following lattice example:

library(lattice)
x <- c(1:10, 1:10)
y <- c(10:1, 10:1)
z <- c(1:10, seq(1,20, by=2))
a = c(rep("one",10),rep("two",10))

DF <- data.frame(x, y, z, a)

xyplot(y ~ x | a, groups = z < 5, data = DF, col = c("black", "red"),
 pch=20, cex=0.3)

My question is: how can I increase the tickness of the vertical lines separating the panels?

有帮助吗?

解决方案

You can play do something like this. I cistomize panel function to add a segment to each panel either at left or right depending in the conditioning variables.

xyplot(y ~ x | a, groups = z < 5, data = DF, col = c("black", "red"),
       pch=20, cex=0.3,
       panel = function(...,subscripts){
         limits <- current.panel.limits()
         xx <- limits$xlim
         yy <- limits$ylim
         if(unique(print(DF[subscripts,'a']))=="two"){
           lsegments(xx[1], yy[1], xx[1], yy[2],lwd=20)
         }else{
           lsegments(xx[2], yy[1], xx[2], yy[2],lwd=20)
         }

         panel.xyplot(...,subscripts=subscripts)
       })

enter image description here

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top