Wednesday, November 3, 2010

R draw.key positioning

https://stat.ethz.ch/pipermail/r-help/2009-February/187229.html

The simplest way to change position is to supply a simple 'vp' argument.

xyplot(1~1,
       panel = function(...) {
           require(grid)
           panel.xyplot(...)
           draw.key(list(text=list(lab='catch'),
                         lines=list(lwd=c(2)),
                         text=list(lab='landings'),
                         rectangles=list(col=rgb(0.1, 0.1, 0, 0.1))),
                    draw = TRUE,
                    vp = viewport(x = unit(0.75, "npc"), y = unit(0.9, "npc")))
       })

No comments: