[Rd] what is the best way for an external interface to interact with graphics, libraries
lachmann at eva.mpg.de
Tue Sep 7 20:21:50 CEST 2010
Another message about the R to TeXmacs interface.
The TeXmacs interface allows the user to directly insert graphics into the
Since I am not very familiar with programming for R, I implemented the
interaction with graphics in a very primitive way. It was two modes of
working: with X11, and without (for example when working remotely through
ssh without forwarding X11).
In both cases the user has to invoke a command, v(), in order to insert the
current graph into the buffer at the current place.
With X11, the way it works is that when v() is invoked I call recordPlot(),
then open a postscript file, then replayPlot(), and then close the
postscript file and insert it into the session.
Without X11, I open a postscript file ahead of time, then when v() is
called, I close it, and insert it into the session, and then open a new
Obviously quite primitive.I think ideally would be if everything was
transparent to the user - the user does a plot, and the plot is inserted
into the buffer right away, and later, updates to the same plot update the
original plot where it is. But to be able to do that I need to be able to
generate the postscript file of the current plot, and be notified somehow
whenever the plot changes.
Is all that possible? Is there a better way to implement this all?
A remotely related question is this: the interface with TeXmacs generates
menus that depend on the currently loaded libraries. I'd like to be able to
update the menus whenever a new library is loaded. Is there a possibility to
have a function called whenever this happens? Or would it be advisable to
change the global 'library' function?
View this message in context: http://r.789695.n4.nabble.com/what-is-the-best-way-for-an-external-interface-to-interact-with-graphics-libraries-tp2530208p2530208.html
Sent from the R devel mailing list archive at Nabble.com.
More information about the R-devel