[R] simultaneous plots

2008-12-02 Thread David Epstein

Is there a good and concise way of making simultaneous plots that are
identical, but directed to different devices?

I'm writing an R-script that produces a pdf file. I would really like to
check visually whether the pdf file shows what I expect. So I would like the
same commands to produce a plot on screen. At the moment I'm using
cut-and-paste, which is not ideal because any corrections have to be done
twice---very error-prone.

Thanks
David
-- 
View this message in context: 
http://www.nabble.com/simultaneous-plots-tp20802447p20802447.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@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.


Re: [R] simultaneous plots

2008-12-03 Thread Philipp Pagel
On Tue, Dec 02, 2008 at 02:28:18PM -0800, David Epstein wrote:
> Is there a good and concise way of making simultaneous plots that are
> identical, but directed to different devices?
> 
> I'm writing an R-script that produces a pdf file. I would really like to
> check visually whether the pdf file shows what I expect. So I would like the
> same commands to produce a plot on screen. At the moment I'm using
> cut-and-paste, which is not ideal because any corrections have to be done
> twice---very error-prone.

I usually keep my pdf viewer (kpdf) open which automatically refrehes
once I re-create the plot. On windows this is a problem, as far
as i know. You may get what you are after by storing the plot
with recordPlot() and then use replayPlot() to send it to
additional devices.

cu
Philipp

-- 
Dr. Philipp Pagel
Lehrstuhl für Genomorientierte Bioinformatik
Technische Universität München
Wissenschaftszentrum Weihenstephan
85350 Freising, Germany
http://mips.gsf.de/staff/pagel

__
R-help@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.


Re: [R] simultaneous plots

2008-12-03 Thread Prof Brian Ripley

On Wed, 3 Dec 2008, Philipp Pagel wrote:


On Tue, Dec 02, 2008 at 02:28:18PM -0800, David Epstein wrote:

Is there a good and concise way of making simultaneous plots that are
identical, but directed to different devices?

I'm writing an R-script that produces a pdf file. I would really like to
check visually whether the pdf file shows what I expect. So I would like the
same commands to produce a plot on screen. At the moment I'm using
cut-and-paste, which is not ideal because any corrections have to be done
twice---very error-prone.


How about dev.copy2pdf ?


I usually keep my pdf viewer (kpdf) open which automatically refrehes
once I re-create the plot. On windows this is a problem, as far
as i know.


Depends on the viewer: GSView (and others based on ghostscript) do allow 
the file to be updated whilst open: Acrobat Reader does not.


--
Brian D. Ripley,  [EMAIL PROTECTED]
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, UKFax:  +44 1865 272595

__
R-help@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.


Re: [R] simultaneous plots

2008-12-03 Thread David Epstein



Prof Brian Ripley wrote:
> 
> How about dev.copy2pdf ?
> 

I put the following into a script:
quartz(...)
#many graphics commands
dev.copy2pdf(pdf,file="ratio1.pdf")

and then sourced the script. I got the error message
Error in pdfFonts(family) : 
  invalid arguments in 'pdfFonts' (must be font names)

I found the various help files on dev.copy and dev.next, etc very hard to
understand. And I have no idea how to fix the error. I'm trying to use
defaults as much as I can.

Could you possibly give a few more lines of code by way of example, Brian?
And is a dev.off() command needed after the dev.copy()?
Thanks a lot for your helpful replies to so many queries. They are much
appreciated.
David

-- 
View this message in context: 
http://www.nabble.com/simultaneous-plots-tp20802447p20810628.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@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.


Re: [R] simultaneous plots

2008-12-03 Thread Prof Brian Ripley

On Wed, 3 Dec 2008, David Epstein wrote:





Prof Brian Ripley wrote:


How about dev.copy2pdf ?



I put the following into a script:
quartz(...)
#many graphics commands
dev.copy2pdf(pdf,file="ratio1.pdf")


Just

dev.copy2pdf(file="ratio1.pdf")





and then sourced the script. I got the error message
Error in pdfFonts(family) :
 invalid arguments in 'pdfFonts' (must be font names)

I found the various help files on dev.copy and dev.next, etc very hard to
understand. And I have no idea how to fix the error. I'm trying to use
defaults as much as I can.

Could you possibly give a few more lines of code by way of example, Brian?
And is a dev.off() command needed after the dev.copy()?
Thanks a lot for your helpful replies to so many queries. They are much
appreciated.
David

--
View this message in context: 
http://www.nabble.com/simultaneous-plots-tp20802447p20810628.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@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,  [EMAIL PROTECTED]
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, UKFax:  +44 1865 272595

__
R-help@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.