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.

Michael

On Thu, Jun 12, 2008 at 8:13 PM, Sebastian P. Luque <spluque@gmail.com>
wrote:

> Hi,
>
> Several years ago I was looking for ways to embed R graphics into Tk
> widgets, and abandoned the idea after finding out it was way too
> difficult, at least for my purposes.  More recently, I looked again and
> found Luke Tierney's trkplot, which allows one to do just this.
> However, there seem to be limitations like inability to resize the
> graphs along with the widgets.  That's not a big encumbrance in my case,
> but the difficulty in accessing the R plot's coordinates is.  The only
> guidance I could find was that in James Wettenhall:
>
>
> http://bioinf.wehi.edu.au/~wettenhall/RTclTkExamples/InteractiveTkrPlot.html<http://bioinf.wehi.edu.au/%7Ewettenhall/RTclTkExamples/InteractiveTkrPlot.html>
>
> but it issues an enigmatic message for the calculated coordinates:
>
> "Label Point Closest to These Approximate Plot Coordinates"
>
> Is that the best approach available, or are there better alternatives?
>
> My idea is to implement an integrated interface for a plotting utility I
> wrote for package diveMove, which gathers pairs of coordinates from
> mouse clicks (in standard unembedded graphs for now):
>
> ---<---------------cut here---------------start-------------->---
> install.packages("diveMove")  # from any CRAN
> data(divesTDR)
> depth.zoc <- zoc(getTime(divesTDR), getDepth(divesTDR), offset=3)
> coords <- plotTD(getTime(divesTDR), depth.zoc)
> ---<---------------cut here---------------end---------------->---
>
> Clicking on the "Zero-Offset Correct a Range" button, followed by a pair
> of clicks in the graph, gathers coordinates using locator().  Because
> users may need to zoom and pan across different scales, it is important
> to allow for resizing of the plot.
>
> Any recommendations on how to embed R graphics on Tk widgets, and
> gathering coordinates as above, would be much appreciated.  Thanks.
>
>
> Cheers,
>
> --
> Seb
>
> _______________________________________________
> R-SIG-GUI mailing list
> R-SIG-GUI@stat.math.ethz.ch
> https://stat.ethz.ch/mailman/listinfo/r-sig-gui
>

	[[alternative HTML version deleted]]

