[R-SIG-Mac] "special" paper option of postscript device not working

Marc Schwartz marc_schwartz at me.com
Tue Sep 23 13:27:33 CEST 2014


Denis,

If you are submitting figures to a journal, you don't want a multipage file, you want one plot per file and EPS is a single page format.

They will usually then embed that EPS figure/file in whatever process they use to create the full paper. If they are using LaTeX, there are \includegraphics directives in the source .tex file that will tell the LaTeX processor to insert the EPS file (or other file types) into the resultant document at that point.

If you want a multipage PS file, you can create that, just like a multipage PDF file, but it would not be suitable for the submission of figures.

For example:

postscript("Multipage.ps", height = 5, width = 5)
barplot(1:5)
plot(1:10)
dev.off()

However, each page will be the same size (eg. US letter or A4, as defined by options()$papersize) and the plot size within the page will be defined by the height and width arguments.

Regards,

Marc

On Sep 22, 2014, at 8:51 PM, Denis Chabot <chabot.denis at gmail.com> wrote:

> Thanks Marc,
> 
> You are correct, it works if I add onefile=FALSE. 
> 
> But how would you control page size for a multiple-page document (say 5 figures, one per page), for which you would normally use onefile=TRUE?
> 
> Denis
> Le 2014-09-22 à 13:55, Marc Schwartz <marc_schwartz at me.com> a écrit :
> 
>> On Sep 22, 2014, at 12:15 PM, Denis Chabot <chabot.denis at gmail.com> wrote:
>> 
>>> Hi,
>>> 
>>> The journal where I want to submit does not accept PDF figures, only
>>> postscript (or bitmaps, which I want to avoid).
>>> 
>>> I want to control paper size by combining paper = "special" and "width" and
>>> "height" parameters to the postscript command, but the resulting page is
>>> always 8 x 11, at least as viewed with Preview and Illustrator.
>>> 
>>> This is with this code:
>>>  postscript(file="test.ps", width=5.5, height=4.25, horizontal=T, paper
>>> = "special")
>>>  par(mar=c(2.8, 2.8, 1.8, 0.2)+0.1, xpd=F, mgp=c(1.5,0.5,0), cex.lab=1)
>>> 
>>>  plot(1:10)
>>>  dev.off()
>>> 
>>> The plot occupies 1/4 of the 11x8.5 inch page.
>>> 
>>> I can live with this, but my reading of the postscript device documentation
>>> is that width and height control the size of the paper if I also use the
>>> page = "special" option. Because this could be the result of working on a
>>> Mac, I write here first, but will ask on the general R Help list if this
>>> has nothing to do with the Mac.
>>> 
>>> Thanks in advance,
>>> 
>>> Denis
>> 
>> 
>> Denis,
>> 
>> In general and as noted in the Details section of ?postscript, you will want to create an EPS file, using the following incantation:
>> 
>> postscript(file = ..., width = ..., height = ..., horizontal = FALSE, 
>>            paper = "special", onefile = FALSE)
>> 
>> Thus:
>> 
>> postscript(file = "test.eps", width = 5.5, height = 4.25, 
>>          horizontal = FALSE, paper = "special", onefile = FALSE)
>> par(mar=c(2.8, 2.8, 1.8, 0.2)+0.1, xpd=F, mgp=c(1.5,0.5,0), cex.lab=1)
>> plot(1:10)
>> dev.off()
>> 
>> 
>> On my Mac, with OS X 10.9.5, the attached file is generated in the fashion that you would expect.
>> 
>> There is also the ?setEPS function.
>> 
>> Regards,
>> 
>> Marc Schwartz
>> 
>> <test.eps>
> 



More information about the R-SIG-Mac mailing list