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

Scotti Roberto roberto.scotti at gmail.com
Thu Jun 10 13:17:44 CEST 2010


Il 09/06/2010 17:56, Michael Rutter ha scritto:
>
>
> 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
>
>
Dear Michael, many thanks.
Question 2 is now definitely open.  Activation of the option to 
automatically "record graphics history" is  very handy during 
interactive sessions in order to compare and/or recall previous results. 
Why is it available only under Windows? Are there any technical 
limitations or is it just a question that hasn't yet been considered?

Your reply is very useful for me because I didn't know of the functions 
"recordPlot/replayPlot". I estimate that these can be the building 
blocks for setting up a procedure that substitutes (to some extent) the 
missing functionality.

For the last option you cite (by the way the spelling of the package 
name has a mistake) I found documentation here:
http://bm2.genes.nig.ac.jp/RGM2/R_current/library/agsemisc/man/plotf.html
Nice to know, but it doesn't seem to fit my purposes now.

Thanks again. Sincerely, Roberto

prof. R. Scotti
Forestry school of Nuoro
Università di Sassari - Italy



More information about the R-SIG-Debian mailing list