[R] Rotated viewports in Grid

Gustaf Rydevik gustaf.rydevik at gmail.com
Wed Oct 24 13:25:48 CEST 2007


Hi all,

I'm trying to generate a plot containing a scatterplot, with marginal
densityplots for x and y.
However, when I try to generate a vertical densityplot, I get the
message "warning: can't clip to rotated viewport", and nothing shows
up. I'm probably misunderstanding how viewports are meant to be used,
so if someone could give me a hint, I'd be most grateful.
my system is R 2.5.0 (stuck, and can't upgrade for now) and windoms xp.

many thanks in advance,

Gustaf

example:
--------------------------
library(lattice)
library(grid)
x<-rnorm(20)
y<-rnorm(20)
graph.layout<-grid.layout(nrow=2,ncol=2,widths=unit.c(unit(2,"null"),unit(1,"null")),heights=unit.c(unit(1,"null"),unit(2,"null")))
graph.view<-viewport(layout=graph.layout,name="root")
grid.newpage()
pushViewport(gap.view)
pushViewport(viewport(layout.pos.row=2,layout.pos.col=1))
print(xyplot(x~y),newpage=FALSE)
popViewport()
pushViewport(viewport(layout.pos.row=1,layout.pos.col=1))
print(densityplot(x),newpage=FALSE)
popViewport()
pushViewport(viewport(layout.pos.row=2,layout.pos.col=2,angle=270))
print(densityplot(y),newpage=FALSE) ### I Get the warning message here.
----------------------------------

-- 
Gustaf Rydevik, M.Sci.
tel: +46(0)703 051 451
address:Essingetorget 40,112 66 Stockholm, SE
skype:gustaf_rydevik



More information about the R-help mailing list