[R] Viewport and grid.draw

Judith Flores juryef at yahoo.com
Mon Dec 10 03:58:37 CET 2007


Hi Deepayan and everyone,

   I need to add a common legend to a group of latice
graphs, I have tried different ways using viewport and
grid.draw without success.

Here is what I have:

plot.new()

library(grid)
library('IDPmisc')

print(plot1, split=c(1,1,2,4), more=TRUE)
print(plot4, split=c(2,1,2,4), more=TRUE)
print(plot2, split=c(1,2,2,4), more=TRUE)
print(plot5, split=c(2,2,2,4), more=TRUE)
print(plot3, split=c(1,3,2,4), more=TRUE)
print(plot6, split=c(1,4,1,4), more=FALSE)
grid.text(vp=do.call(viewport,grid.locator(unit="npc")),
label='A', gp=gpar(fontsize=20))
grid.text(vp=do.call(viewport,grid.locator(unit="npc")),
label='B', gp=gpar(fontsize=20))





key1<-draw.leg(key=list(text=list(c('some text',
'text2')),points=list(pch=c(17,15))))
vp.key<-viewport(grid.locator(unit="npc"))
pushViewport(vp.key)
grid.draw(key1)

grid.locator cannot be one of the arguments of
viewport, but waht would be the analog of this
argument in viewport then?

Thank you,

Judith




      ____________________________________________________________________________________
Be a better friend, newshound, and



More information about the R-help mailing list