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

Scotti Roberto roberto.scotti at gmail.com
Thu Jun 10 13:45:00 CEST 2010


Il 10/06/2010 13:30, Deepayan Sarkar ha scritto:
> On Wed, Jun 9, 2010 at 5:42 PM, Scotti Roberto<roberto.scotti at gmail.com>  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??
>>      
> The basic tools required are still available. For example, you can
> easily do manual (command-line) recording and replaying thus:
>
> rp<- function()
> {
>      env<- environment()
>      recorded<- list()
>      current<- 0L
>      record<- function()
>      {
>          current<<- length(recorded) + 1L
>          recorded[[current]]<<- recordPlot()
>          print(current)
>      }
>      replay<- function(n = current - 1L)
>      {
>          if (n>  0&&  n<= length(recorded)) {
>              current<<- n
>              replayPlot(recorded[[current]])
>          }
>          else message("'n' not in valid range: ", n)
>      }
>      restore<- function() replay(n = length(recorded))
>      showPrevious<- function() replay(n = current - 1L)
>      showNext<- function() replay(n = current + 1L)
>      env
> }
>
> rp<- rp()
>
>
> plot(1:10) ## plot something
> rp$record() ## record it
> plot(rnorm(10)) ## plot something else
> rp$record() ## record it
>
> rp$showPrevious() ## show previous plot
> rp$restore() ## show last recorded plot
>
>
> The main trick is to (1) have the plots saved automatically whenever a
> new page is created and (2) have a GUI interface for navigating
> through the history. (1) needs device support (only the device really
> knows when a new page is created), although you can get a partial
> solution using user-level hooks. (2) needs some sort of GUI interface
> to be available, which isn't really there for the x11 device.
>
> So in short, it's technically feasible, but not supported by the
> standard screen device. There are third party screen devices
> available, and it would be easier for them to support recording (if
> they don't already).
>
> -Deepayan
>
>    
Fantastic!
I just finished answering to Dr. Michael A. Rutter and was imagining of 
setting up a procedure using record/replay-Plot.
Yours is far more advanced, many thanks (also for closing question 2)
Roberto



More information about the R-SIG-Debian mailing list