[R-gui] embedding R graphics in Tk widgets

Sebastian P. Luque spluque at gmail.com
Fri Jun 13 21:50:51 CEST 2008


Hi,

Thanks everyone.  To summarize:

- Embedding of R graphics is trivial with several packages: tkrplot,
  rpanel, playwith.  The first two do it through behind-the-scenes
  tcltk, while playwith plays with (couldn't resist it :-) GTK+ and
  Cairo.

- Of these, the most versatile approach seems to be that taken by
  playwith because it allows for resizing of the R graphics, and
  straightforward access to plot coordinates and locator()-like
  functionality.

Looks like I should have a closer look at playwith's code.  Can you
suggest what parts of the code would be useful in the context of the
code in my first post?

Michael -- resizing and/or calling playwith() again as you suggested
solved the problem, although it didn't seem too small (the plot was
drawn properly, independently of the size at which it was redrawn).
However, there some further errors:



On Fri, 13 Jun 2008 18:24:30 +1000,
"Felix Andrews" <felix at nfrac.org> wrote:

> Here is the same using the playwith package:

> library(playwith)
> playwith(plot(1:20, (1:20)^cur.time),
> time.vector=seq(0.05,2,by=0.05))

> When you click on the plot, the location (in plot coordinates) is
> shown inside the window.

It didn't show anything on the window after clicking.  The following
message was shown in the command-line upon resizing:

Error in if (playState$is.lattice) { : argument is of length zero


Cheers,

-- 
Seb



More information about the R-SIG-GUI mailing list