[R] Separate y-limits in xYplot panels II

John Poulsen jpoulsen at zoo.ufl.edu
Tue Apr 8 21:06:06 CEST 2008


Hello,

I have been trying to use xYplot in Hmisc to graph plots, allowing each 
panel to have a y-axis dependent on the data in the panel.

Following the advice from the R-Help list, message: [R] separate 
y-limits in xYplot panels on Wed, 30 May 2007 08:12:06 -0700 (PDT), I 
used scales=list(y=list(relation="free").

However, it does not seem to work.  Please see below code, where the 
scale of the y-axis of the 2 panels stays the same despite the scales 
function.

Does anyone know how to get around this?

Thanks,
John


x1=seq(1,30,0.5)
y1=x1^2
y2=10*(x1^2)
ycomb=c(y1,y2)
y.up=ycomb+0.1*ycomb
y.low=ycomb-0.1*ycomb
grp=rep(c(1,2),each=length(x1))
dat=as.data.frame(cbind(ycomb, y.up, y.low, grp, rep(x1,2)))
colnames(dat)=c("ycomb","y.up","y.low","grp","x1")

with(dat, xYplot(Cbind(ycomb, y.up, y.low)~x1|factor(grp), 
data=dat,type="l", method="bands", scales=list(y=list(relation="free"),
        x=list(alternating=c(1,1,1)))))



More information about the R-help mailing list