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

Prof Brian Ripley ripley at stats.ox.ac.uk
Tue Aug 2 07:28:22 CEST 2011


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