[R] Layout, xyplot and saving in file
Jean-Louis Abitbol
abitbol at sent.com
Sat Mar 11 17:26:38 CET 2006
Dear all,
I am trying to use layout with xyplot and save the plot in a file.
The saved file contains only the last panel (used jpg, wmf and pdf
options in the savePlot function)
I am not familiar with the graphic file formats and don't know if they
can handle multipage output.
If not do I need to loop by ndose in the following script ?
Here is my script:
-----------------------------------------------------------------------------------------
lattice.options(default.theme ="col.whitebg")
trellis.device(width=11.9, height=8.5, new = TRUE)
couleurs<-brewer.pal(5,"Dark2")
sp <- list(superpose.symbol = list(pch =c(1,15,2,12,19),cex =
0.4,col=couleurs),
superpose.line = list(col = couleurs, lty =1:5, cex=1))
test<-xyplot(egheart~ctime|patnam, data=decg, type="b", groups=ndose,
main="Heart Rate",
xlab = "Time", ylab = "Heart Rate (bpm)",
layout=c(2,5),
par.strip.text=list(cex=0.5),
auto.key =
list(title="Dose",cex.title=1,columns=5,space="top",points=TRUE,lines=TRUE),
scale=list(x=list(rot=45,tick.number=0,
relation="free",cex=0.01,tck=0.1),
y=list(tick.number=6),cex=0.6,rot=45,relation="free"),
par.settings=sp,
index.cond=list(unique(decg$patnam[order(decg$ndose)]))
)
print(test)
savePlot(filename="d:/plotfiles/HRindiv",
type="wmf",
device=dev.cur())
----------------------------------------------------------------------------------------------
Note that the cex=0.01 in the x scale is the poor man's solution that I
have found to minimize
the height of the labelling of the x axis as apparently there is no way
to take it out when relation is set to "free" and get something that I
can save taking out the layout line.
Thanks for any advice on how to use layout and save the multiple pages
in a file,
Best regards, Jean-Louis
More information about the R-help
mailing list