[R] Blank eps output files
Sundar Dorai-Raj
sundar.dorai-raj at pdf.com
Tue Dec 7 01:15:13 CET 2004
Sivakumar Mohandass wrote:
> Dear all,
>
> The following commands results in a blank graph file,
>
> postscript(file = "C:/Temp/Fig1.eps", height=4.0, width=4.0,
> horizontal = FALSE, onefile = FALSE, paper = "special")
>
> x11(height=3,width=3)
> par(mar=.1+c(4.5,4.5,0,0))
>
> x <- c(10,20,30)
> y <- c(5, 7, 9)
> plot (x,y)
> dev.off()
>
Your code above opens 2 devices (1=postscript, 2=x11) and only writes to
the second. Thus nothing is ever written to nor do you ever close the
first device. I think what you want is:
postscript(file = "C:/Temp/Fig1.eps", height=4.0, width=4.0,
horizontal = FALSE, onefile = FALSE, paper = "special")
par(mar=.1+c(4.5,4.5,0,0))
x <- c(10,20,30)
y <- c(5, 7, 9)
plot (x,y)
dev.off()
The fact that you never closed the first device explains why you
couldn't view it outside of R.
--sundar
> The codes function normally without any error in the command window.
> However, the resulting files (I tried .eps, .emf and .jpeg) are all too
> small in size (< 5 mb). The .jpeg file which one can normally preview in a
> Windows OS, says it's not available for preview when double clicked upon.
>
> I am using R version 2.0.0. Are there any changes to the coding in this
> version? Does anyone know how to fix this?
>
> Thank you in advance,
> Shiva
More information about the R-help
mailing list