Not sure what output you get in the first case. You don't need:
ps.options=setEPS()
just:
setEPS()
Using:
set.seed(1)
test <- matrix(runif(500*500), 500)
setEPS()
postscript(file = "exponcoverapprox.eps")
boxplot(test[30, 1:500], test[90, 1:500], test[150, 1:500], test[210, 1:500],
test[270, 1:500], test[330, 1:500], test[390, 1:500],
names = c("1", "3", "5", "8", "10", "13", "1"), outline = FALSE,
ylim=c(0.01, 50), log = "y", xlab = "xvalue", ylab = "yvalue",
boxwex=0.5, pars = list(whisklwd = 0, staplelwd = 0))
dev.off()
I get the attached output which seems to be OK.
Marc
On Aug 17, 2011, at 10:02 AM, Alaios wrote:
> The problem is a bit weird.
>
> This does not work:
>
> ps.options=setEPS()
> postscript(file="exponcoverapprox.eps")
> boxplot(test[30,1:500],test[90,1:500],test[150,1:500],test[210,1:500],test[270,1:500],test[330,1:500],test[390,1:500],names=c("1","3","5","8","10","13","1"),outline=FALSE,ylim=c(0.01,50),log="y",
> xlab = "xvalue",ylab="yvalue",boxwex=0.5, pars
> =list(whisklwd=0,staplelwd=0))
> dev.off()
>
>
>
>
> This works
> postscript(file="exponcoverapprox.eps")
> boxplot(test[30,1:500],test[90,1:500],test[150,1:500],test[210,1:500],test[270,1:500],test[330,1:500],test[390,1:500],names=c("1","3","5","8","10","13","1"),outline=FALSE,ylim=c(0.01,50),log="y",
> xlab = "xvalue",ylab="yvalue",boxwex=0.5)
> dev.off()
>
>
>
> To not bother you with the details, the only difference is the pars
> =list(whisklwd=0,staplelwd=0) at the end of the boxplot , which I use to
> remove the whiskers fromt he blot.
>
> B.R
>
>
>
> ________________________________
> From: Marc Schwartz <[email protected]>
>
> Cc: "[email protected]" <[email protected]>
> Sent: Tuesday, August 16, 2011 7:38 PM
> Subject: Re: [R] postscript( does not save the plot
>
> On Aug 16, 2011, at 12:32 PM, Alaios wrote:
>
>> Dear all,
>> I am using the following code to write the plot to an eps format
>>
>> postscript(file="test.eps",horizontal=FALSE)
>>
>> boxplot(test[30,1:500],test[90,1:500],test[150,1:500],test[210,1:500],test[270,1:500],test[330,1:500],test[390,1:500],names=c("1","3","5","8","10","13","1"),outline=FALSE,ylim=c(0.01,50),log="y",
>> xlab = "xvalue",ylab="yvalue",boxwex=0.5, pars
>> =list(whisklwd=0,staplelwd=0))
>>
>> dev.off()
>>
>>
>> This creates a 6kb eps file, that can not be opened by any program. I tired
>> with photoshop gimp, acrobat reader. This is the normal process I follow to
>> save my plots.
>>
>> dev.off always returns 1.
>>
>> and the boxplot function succesfullu does the plot in the screen.
>>
>> What might be the problem?
>>
>> I would like to thank you in advance for your help
>>
>> B.R
>> Alex
>
>
>
> You did not create an EPS file. See ?postscript and pay attention to the
> fourth paragraph under Details:
>
> The postscript produced for a single R plot is EPS (Encapsulated PostScript)
> compatible, and can be included into other documents, e.g., into LaTeX, using
> \includegraphics{<filename>}. For use in this way you will probably want to
> use setEPS() to set the defaults as horizontal = FALSE, onefile = FALSE,
> paper = "special". Note that the bounding box is for the device region: if
> you find the white space around the plot region excessive, reduce the margins
> of the figure region viapar(mar=).
>
>
> HTH,
>
> Marc Schwartz
______________________________________________
[email protected] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.