[R] how to control to save plots to which dev

Duncan Murdoch murdoch.duncan at gmail.com
Fri Aug 5 18:02:28 CEST 2011


On 05/08/2011 11:49 AM, zhenjiang xu wrote:
> Thanks, Prof Ripley. I was using dev.next(), dev.prev(),, but I am
> wondering, instead of switching the current dev, is there a way to
> more directly print plot A into file connection A, plot B into file
> connection B...? Because if coding with more then two dev
> simultaniously, one could easily get confused which dev is the current
> one.

dev.set() will do exactly that (and Prof. Ripley did point you to it).

Duncan Murdoch
> On Tue, Aug 2, 2011 at 1:28 AM, Prof Brian Ripley<ripley at stats.ox.ac.uk>  wrote:
> >  On Tue, 2 Aug 2011, David Winsemius wrote:
> >
> >>
> >>  On Aug 1, 2011, at 11:14 PM, zhenjiang xu wrote:
> >>
> >>>  Hi,
> >>>
> >>>  I have a for loop to make 2 types of plots and I'd like to save one
> >>>  type of plots to a pdf file and the other to another pdf file. How can
> >>>  I control which plot will be saved to which pdf? Thanks
> >>
> >>  Why not give them file names that identify the type?
> >
> >  I think he wants
> >
> >  pdf("a.pdf")
> >  pdf("b.pdf")
> >  for(i in 1:n) {
> >  plot something on a.pdf
> >  plot something on b.pdf
> >  }
> >
> >  This is done using dev.prev/dev.next/dev.set: see their help for details.
> >
> >>
> >>  --
> >>
> >>  David Winsemius, MD
> >>  West Hartford, CT
> >>
> >>  ______________________________________________
> >>  R-help at r-project.org 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.
> >>
> >
> >  --
> >  Brian D. Ripley,                  ripley at stats.ox.ac.uk
> >  Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
> >  University of Oxford,             Tel:  +44 1865 272861 (self)
> >  1 South Parks Road,                     +44 1865 272866 (PA)
> >  Oxford OX1 3TG, UK                Fax:  +44 1865 272595
> >
>
>
>



More information about the R-help mailing list