[R] Error in multiple xyplots
Rodrigo Abt
rodrigo.abt at sii.cl
Mon Feb 23 16:57:15 CET 2004
Dear R-listers,
I got an error when I try to plot two grouped data into a single
win.metafile device:
library(lattice)
trellis.device(device="win.metafile",color=F,filename="Profiles-Var1.wmf")
par(mfrow=c(1,2))
# First plot
xyplot(log(v)~t|id,data=Con.20,
main="Group A: Control, Var-1",
xlab="ocasion",ylab="var1",
panel=function(x,y) {
m<-sort.list(x)
panel.grid()
panel.xyplot(x[m],y[m],type="b",cex=0.8)
}
)
# Second plot
xyplot(log(v)~t|id,data=Trt.20,
main="Group B: Treat, Var-1",
xlab="ocasion",ylab="var1",
panel=function(x,y) {
m<-sort.list(x)
panel.grid()
panel.xyplot(x[m],y[m],type="b",cex=0.8)
}
)
When then last plot is entered, a messagebox pops up an says "Unable to
create metafile", and R shutdowns. However, if I use simple plots instead of
xyplots, then it works:
trellis.device(device="win.metafile",color=F,filename="Simple-Plots.wmf")
par(mfrow=c(1,2))
# First plot
plot(1:10,rnorm(10),main="Plot 1")
# Second plot
plot(1:10,rnorm(10),main="Plot 2")
No error, so I call dev.off() and the file generated is OK.
I tried plotting the data in separate 'win.metafile' devices (files) and
worked perfect. I've read the R help, googled around and searched the R-list
for a similar problem and found nothing...any clues ?
I'm working with win2K and R-1.8.1.
Regards,
Rodrigo Abt B,
Analyst,
Dept. Economic Studies,
SII, Chile.
More information about the R-help
mailing list