[R-gui] embedding R graphics in Tk widgets

Sebastian P. Luque spluque at gmail.com
Fri Jun 13 06:05:27 CEST 2008

On Thu, 12 Jun 2008 20:46:34 -0700,
"Michael Lawrence" <mflawren at fhcrc.org> wrote:

> Well, this doesn't really solve your Tk problem, but you could
> integrate graphics with a GUI using cairoDevice and RGtk2. The
> cairoDevice package supports resizing, and using par("plt") and
> par("usr") as in the tkrplot example you cited allows for mapping
> between device and data coordinates.

> See the playwith package for an example of interactive graphics using
> cairoDevice.

Thanks Michael, I'll look at the code, but trying playwith() gave a few
errors, although the package installed ok:

---<---------------cut here---------------start-------------->---
R> playwith(plot(treering2, xlim=c(0,300)), 
+         time.mode = TRUE,
+         labels = paste(time(treering2), "CE"))
Loading required package: RGtk2
Error in plot.new() : figure margins too large
R> Error in if (playState$is.lattice) { : argument is of length zero
R> sessionInfo()
R version 2.7.0 (2008-04-22) 


attached base packages:
[1] grid      stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] RGtk2_2.12.5-3  playwith_0.8.51 lattice_0.17-8 

loaded via a namespace (and not attached):
[1] cairoDevice_2.8      gridBase_0.4-3       gWidgets_0.0-28      gWidgetsRGtk2_0.0-35 tools_2.7.0         
---<---------------cut here---------------end---------------->---

But I guess I can see how to work with CairoDevice and RGtk2 by looking
at the source.  Thanks.


More information about the R-SIG-GUI mailing list