Skip to content

simultaneous plots

5 messages · David Epstein, Philipp Pagel, Brian Ripley

#
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
#
On Tue, Dec 02, 2008 at 02:28:18PM -0800, David Epstein wrote:
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
#
On Wed, 3 Dec 2008, Philipp Pagel wrote:

            
How about dev.copy2pdf ?
Depends on the viewer: GSView (and others based on ghostscript) do allow 
the file to be updated whilst open: Acrobat Reader does not.
#
Prof Brian Ripley wrote:
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
#
On Wed, 3 Dec 2008, David Epstein wrote:

            
Just

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