sebble
sebble

Reputation: 123

Can I embed cranvas interactive graphics into gWidgets (gWidgetsQt) in R

I would like to know if there is a way to embed a cranvas interactive plot within a gWidgets GUI when using R. cranvas requires qtpaint and qtbase so the toolkit would probably be gWidgetsQt.

I was told that PlotView is a qWidget and so it should be possible to add a new gWidget e.g., ginteractive that wraps a cranvas plot.

See this Google Groups thread. If you need more info just ask, I am not a maintainer of cranvas though.

Upvotes: 3

Views: 567

Answers (1)

jverzani
jverzani

Reputation: 5700

It required a slight change to gWidgetsQt (on r-forge now), but is now straightforward using the add method of a ggroup object. Here I embed an example from the qtime man page:

g <- ggroup(cont=gwindow())
require(cranvas)
data(nasa)
nasa11 <- subset(nasa, Gridx == 1 & Gridy == 1)
qnasa <- qdata(nasa11)
selected(qnasa)[1] <- TRUE
cobj <- qtime(qnasa, TimeIndx, ts)

add(g, cobj)

Please, if you find bugs in gWidgetsQt, share them my way. The package is still new.

Upvotes: 2

Related Questions