Re: [R] multiple graphs in the same ps file ?

From: Marc Schwartz <MSchwartz_at_mn.rr.com>
Date: Fri 28 Oct 2005 - 23:23:33 EST

On Fri, 2005-10-28 at 08:01 -0500, Marc Schwartz wrote:
> On Fri, 2005-10-28 at 14:48 +0200, Florence Combes wrote:
> > Dear all,
> >
> > I would like to be able to store multiple graphs in one ps or pdf file, but
> > I cannot achieve this only if I don't shut the "postscript" device between
> > the graphs.
> >
> > here is what I managed to do :
> > > postscript(file="test_graph.eps", onefile=TRUE)
> > > plot(1:10)
> > > plot(1:20)
> > >
> > > dev.off()
> > ---------------------------------------------------------------------------
> >
> > but when I try :
> >
> > > postscript(file="test_graph.eps", onefile=TRUE)
> > > plot(1:10)
> > > dev.off
> > [execution of another part of the code and then:]
> > > plot(1:20)
> > > dev.print(postscript, onefile=TRUE)
> > > dev.off()
> >
> > I only have one page in my file "test_graph.eps" which only contains the
> > last graphics.
> >
> > So I wonder : is it possible to reopen a ps or pdf file and to add data (I
> > tried the "append=TRUE" option but without success) ?
> >
> > Thanks a lot
> >
> > Florence.
>
> As per ?postscript the 'append' argument is _disregarded_. Please review
> the help page more carefully.
>
> If you want more than one plot per PS file, do not use dev.off() between
> plots:
>
> postscript(file="test_graph.eps", onefile = TRUE)
> plot(1:5)
> barplot(1:5)
> dev.off()

One more clarification which I forgot to mention here.

If you want an EPS file (encapsulated postscript) for inclusion in another document (ie. LaTeX or importing into another application), you cannot have more than one page in the PS file and must use a postscript call the looks something like this:

  postscript(file="test_graph.eps", onefile = FALSE, horizontal = FALSE,

             paper = "special", ...)

See the Details section of ?postscript for more information. The three key arguments are 'onefile', 'horizontal' and 'paper'.

HTH, Marc Schwartz



R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Fri Oct 28 23:27:20 2005

This archive was generated by hypermail 2.1.8 : Sat 29 Oct 2005 - 00:13:02 EST