Viewport and grid.draw
On Dec 9, 2007 6:58 PM, Judith Flores <juryef at yahoo.com> wrote:
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.
Try looking at the first example in http://dsarkar.fhcrc.org/lattice/book/Chapter12-Interaction/edited.R for inspiration. -Deepayan
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 ______________________________________________ R-help at r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.