[R] doubleYScale from latticeExtra, problems with style

Troels Ring tring at gvdnet.dk
Tue Aug 5 19:22:11 CEST 2014


Dear friends - below is a small example showing a problem I have 
understanding doubleYScale from latticeExtra -
R version 3.0.2 (2013-09-25) -- "Frisbee Sailing"
Copyright (C) 2013 The R Foundation for Statistical Computing
Platform: x86_64-w64-mingw32/x64 (64-bit)

Both obj1 and obj2 are formatted as I wanted - but when combined the 
formatting is lost. How comes?
Best wishes
Troels Ring
Aalborg, Denmark

library(latticeExtra)
T <- seq(1,200,length=100)
Y1 <- 10+2*T+0.05*T^2 + rnorm(100,0,40)
Y2 <- 0.1 + sqrt(T)+rnorm(100,1,1)
tesobj <- data.frame(T=T,Y1=Y1,Y2=Y2)


obj1 <- 
xyplot(Y1~T,tesobj,xlab=list(label="Time",cex=1.5),ylab=list(label="Y1",
cex=1.5),scales=list(y=list(cex=1.2),x=list(cex=1.2)),
panel = function(x,y,...){
panel.xyplot(x,y,...,pch=19)
panel.loess(x,y,...,lwd=3)
})
obj1

obj2 <- 
xyplot(Y2~T,tesobj,xlab=list(label="Time",cex=1.5),ylab=list(label="Y2",
cex=1.5),scales=list(y=list(cex=1.2),x=list(cex=1.2)),
panel = function(x,y,...){
panel.xyplot(x,y,...,pch=20)
panel.loess(x,y,...,lwd=3)})
obj2

(sd <- doubleYScale(obj1,obj2,add.ylab2=TRUE))



More information about the R-help mailing list