Possible Duplicate:
Generate multiple graphics from within an R function
I have tried to make an eps-file of a lattice plot. The .eps-file is created, but the plot seem to be blank (using 'gv'). I have been searching the inter-net for a solution, but without luck.
My code is as follows:
mydf <- data.frame(col1=c(1,1,2,2,3), col2=c(1,2,1,2,1), col3=rnorm(5))
library(lattice)
filename <- "myfile.eps"
postscript(file = filename,
width = 10, height = 10,
horizontal = FALSE, onefile = FALSE, paper = "a4")
xyplot(col3 ~ col1 | col2, data = mydf)
dev.off()
I have tried to substitute the postscript(...)
expression with
trellis.device("postscript", color = TRUE,
height = 10, width = 10,
horizontal = FALSE, onefile = FALSE, paper = "a4")
The '.eps-file' is created using both postscript(...)
and trellis.device(...)
, but seems blank looking at it with 'gv' no matter what I do.
I am greatful for any help or guidance. Sisse