[rkward-devel] paginate onscreen graphics device

Thomas Friedrichsmeier thomas.friedrichsmeier at ruhr-uni-bochum.de
Sun Jun 20 09:22:35 UTC 2010


Hi,

On Saturday 19 June 2010, Prasenjit Kapat wrote:
> Looking at Deepayan's reply:
> http://article.gmane.org/gmane.comp.lang.r.debian/1268
> 
> i think it might be "easy" to implement the history part (paginated
> device may be more difficult) for our graphics device.
> 
> The idea would be to store the plotting calls into a list
> (.rk.something) and with two top level menu entries ('<' and '>') on
> the graphics window we could flip through the list...
> 
> Is it at all easy to implement, or am I hallucinating?

first a technical note: The graphics device in RKWard is simply the native R 
device. All we do is to "capture" that window, and add our own menus to it.

Thus, the difficult part remaining from Deepayan's mail is 1: figuring out just 
when R is about to overwrite the existing plot with something new 
(alternatively: figuring out, when a plot has been completed). Unfortunately, 
the hook in plot.new() gets called directly *after* the previous plot has been 
blanked, so that is too late for our purpose.

I suppose it might be possible to override plot.new() using 
assignInNamespace(). See the bottom of internal.R for our procedure to 
override "menu" and "select.list" in the "utils" package (rk.fix.assignments() 
is called during initialization).

The main work would be done in R: If you can come up with R code that gets 
called for every new plot (in the onscreen device), and saves the previous 
plot into a list (perhaps limiting the total object.size() of saved plots to 
some user-definable amount), then adding a gui to flip through the list will 
indeed be easy.

(Of course there are some additional questions to find an answer for, such as: 
Keep a separate list for each device window, or a single list for all? Clear 
the list, when the corresponding device windows is closed?)

Regards
Thomas
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part.
URL: <http://mail.kde.org/pipermail/rkward-devel/attachments/20100620/daabd326/attachment.sig>


More information about the Rkward-devel mailing list