[R-sig-Debian] "Graphics history" in UNIX

Michael Rutter mar36 at psu.edu
Wed Jun 9 17:56:55 CEST 2010



On 06/09/2010 08:12 AM, Scotti Roberto wrote:
> Hello. First post, please excuse lack of experience.
>
> I recently switched from MS-Win to Kubuntu and find it rather difficult
> to recover Cran-R ease of use.
> The "Graphics history" facility available under Windows was, for me,
> extremely useful.
>   From Murrell's 2005 book (see citation below) I understand that no such
> facility is available under non-Windows systems.
> In R-help archive, a 2000 comment from Ripley seems to confirm. (see below)
> Questions:
> - do I correctly understand that  "No<Graphics history>  facility is
> available for Linux systems"?
> - (if Yes above) Please, let me understand why??
> Many thanks for sharing.
> Sincerely, Roberto Scotti
>
> ------------------------
> from:     http://www.stat.auckland.ac.nz/~paul/RGraphics/chapter1.pdf
> "1.3.2 Multiple pages of output"
> "For a screen device, starting a new page involves clearing the window
> before
> producing more output. On Windows there is a facility for returning to
> previous
> screens of output (see the \History" menu, which is available when a
> graphics window has focus), but on most screen devices, the output of
> previous
> pages is lost."
> ------------------------
>
> *Subject: *Re: [R] Activating Graphics History
> *From: *Prof Brian D Ripley (/ripley at stats.ox.ac.uk/)
> *Date: *Sat 29 Jan 2000 - 08:06:24 EST
>
>      * *In reply to:* Jim Ianelli: "[R] Activating Graphics History
>        <http://tolstoy.newcastle.edu.au/R/help/00a/0196.html>
>
> Message-ID:<Pine.GSO.4.05.10001282201420.18401-100000 at auk.stats>
>
> On Fri, 28 Jan 2000, Jim Ianelli wrote:
>
> />  I'm having trouble finding documentation on how /
> />  to activate the "record graphics history" option via /
> />  a command line (as opposed to having to use the menu). /
> ///.............../
> />  But I can't find anything about setting the recording of plots /
> />  without using the menu. /
>
> Crucially, you did not say you were doing this on Windows, and it is only
> available on the windows() device on Windows. I am not aware of any way to
> do this.
>

Scott,

I am not aware of anything that replicates the "record graphics history" 
in Ubuntu.  However, there are some tools/tricks that can be helpful.

1.  If you run an .R file in batch mode (R CMD BATCH foo.R), any plots 
the code creates will be collected in the "Rplots.pdf" file.  You can 
then use any pdf viewer to view the plots.

2.  If you want to save a specific plot, try 'foo <- recordPlot()'. 
That will save the plot to 'foo'.  To view the plot again, 
'replayPlot(foo)'.

3.  If you are using R interactively, if you enter the command 
'pdf("Rplots.pdf")', any plot you create will be written to that file. 
The downside is that the plot will not be shown on the screen.  However, 
if you open that pdf file, you can view the contents of the file as it 
is being updated.  So, as I work in a window and create a new plot, it 
is appended to the pdf file and shows up a second later in the pdf 
viewer.  You can then page through the plots.  Kind of a hack, put it works.

I don't think there is a way to easily plot to multiple devices, say a 
pdf and a X11, at the same time.  There is a function plotf in the 
agesmisc package that appears to do this, but I haven't played with it.

Hope this helps,
Michael


-- 
Dr. Michael A. Rutter
School of Science
Penn State Erie, The Behrend College
Station Road
Erie, PA 16563
http://math.bd.psu.edu/faculty/rutter



More information about the R-SIG-Debian mailing list