require("grid") require("lattice") fred = data.frame(x=1:5,y=runif(5)) vplayout <- function (x,y) viewport(layout.pos.row=x, layout.pos.col=y) grid.newpage() pushViewport(viewport(layout=grid.layout(2,2))) p = xyplot(y~x,fred) print( p,newpage=FALSE,draw.in=vplayout(2,2)$name)
On Mon, Jul 12, 2010 at 8:58 AM, Felix Andrews <fe...@nfrac.org> wrote: >> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html >> and provide commented, minimal, self-contained, reproducible code. > > Yes, please, reproducible code. > > > > On 10 July 2010 00:49, Mark Connolly <wmcon...@ncsu.edu> wrote: >> I am attempting to plot a trellis object on a grid. >> >> vplayout = viewport(layout.pos.row=x, layout.pos.col=y) >> >> grid.newpage() >> pushViewport(viewport(layout=grid.layout(2,2))) >> >> g1 = ggplot() ... >> g2 = ggplot() ... >> g3 = ggplot() ... >> p = xyplot() ... >> >> # works as expected >> print(g1, vp=vplayout(1,1)) >> print(g2, vp=vplayout(1,2)) >> print(g3, vp=vplayout(2,1)) >> >> # does not work >> print( p, >> newpage=FALSE, >> draw.in=vplayout(2,2)$name) >> >> Error in grid.Call.graphics("L_downviewport", name$name, strict) : >> Viewport 'GRID.VP.112' was not found >> >> >> What am I doing wrong? >> >> Thanks! >> >> ______________________________________________ >> R-help@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. >> > > > > -- > Felix Andrews / 安福立 > http://www.neurofractal.org/felix/ > ______________________________________________ R-help@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.