Many thanks again for your code.
Actually, manual typing of the function names to record or review plots
is not a practical solution for me.
I taught it would be a quick task to program Function keys for this purpose.
I uselessly spent time messing with a "<home>.initrc " file.
The only solution I found is to write the functions names, via Bash
menu Settings>ModifyProfile>Input,
in the "Output" column of a new Console:
F10+AnyModifier : source("/.../GraphicsHistorySubstitute.R")'
##
initialise
F10-AnyModifier : rp$record()\n ## record current plot'
F11-AnyModifier : rp$showPrevious()\n ## show previous recorded plot'
F11+AnyModifier : rp$showNext()\n ## show next recorded plot'
F12-AnyModifier : rp$restore()\n ## show last recorded plot'
Do you know if and how to achieve the same effect writing a script
instead of interactively coding key functions?
Thanks for caring, Roberto Scotti
-------- Messaggio originale --------
Oggetto: Re: [R-sig-Debian] "Graphics history" in UNIX
Data: Thu, 10 Jun 2010 13:45:00 +0200
Mittente: Scotti Roberto <roberto.scotti@gmail.com>
A: Deepayan Sarkar <deepayan.sarkar@gmail.com>
CC: r-sig-debian@r-project.org
Il 10/06/2010 13:30, Deepayan Sarkar ha scritto:> On Wed, Jun 9, 2010 at 5:42 PM, Scotti
Roberto<roberto.scotti@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
[[alternative HTML version deleted]]