[rkward-devel] Request for feedback on plot history

Prasenjit Kapat kapatp at gmail.com
Mon Sep 6 17:55:21 UTC 2010


HI,

On Mon, Sep 6, 2010 at 11:10 AM, Thomas Friedrichsmeier
<thomas.friedrichsmeier at ruhr-uni-bochum.de> wrote:
> Hi,
>
> On Monday 06 September 2010, Stefan Rödiger wrote:
>> The dropdown menu ("What next? c") would be really helpful. Indicating the
>> number of the plot and the fist bit of the commands used would be
>> sufficient for me. Something like:
>>
>> 1     plot(rnorm(...
>> 2     hist(data...
>> ...
>
> I've added a drop-down menu (Prasenjit, I hope I did not get into your way

Great! Now, I have all the more reason to finish up the new re-write quickly.

> with this; the changes in public_graphics.R are fairly straightforward,
> though). Of course for "normal" (non lattice) plots, showing the plot command
> is probably impossible, technically.

Yes, for graphics::XXXX () functions this will be impossible. Here is
an idea, may not work though (and I am not going to try it until the
main stuff is done):

Can we get the last command from history?

Remember we are only interested in the primary plotting functions.
Unfortunately, utils::history () calls file.show () in the end, so I
don't think the paged output can be assigned to any variable. I was
thinking of writing another history function (almost the same as
utils::history) which would search for plot ()-type patterns, eg:
"^(plot|hist|boxplot|...)". This function would be called from our
wrapped plot.new () just before record () call. A properly crafted
regex pattern, can hunt down the first line of a multiline command as
well.

Again, this is just an idea. What do yo think? Will it work?

> This is still buggy when you are navigating from a yet unsaved plot to a
> different position, when the history is already filled to the maximum length. It
> should be possible to fix this, but since it probably needs to make some
> assumptions about the internals of the implementation, I thought I rather wait
> for the next version before bothering with this.

Yes, lets wait for the re-write.

Regards,
-- 
Prasenjit




More information about the Rkward-devel mailing list