Skip to content
Prev 248660 / 398506 Next

adding text to y-axis per row of panels (lattice)

On Thu, Jan 20, 2011 at 2:04 PM, E Hofstadler <e.hofstadler at gmail.com> wrote:
You could do it like this, but some manual tweaking will be involved
to get nice positions.


labs <- c("too low", "balanced", "too high")
pos <- c(0.14, 0.43, 0.8)

xyplot(vary~varx|condvar, type="o",data=exampledata,
       scales=list(alternating=F,x=list(at=c(1,2,3,4)),
                   y=list(at=c(-3,-1,0,1,3))),
       panel=function(x,y,...){
           panel.abline(h=-1)
           panel.abline(h=1)
           panel.xyplot(x,y,...)
       },
       ylab.right = list(label = rep(labs, 2),
                         y = c(pos/2, 0.52 + pos/2)))


-Deepayan