3

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.

sebble
  • 123
  • 1
  • 8

1 Answers1

2

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.

jverzani
  • 5,600
  • 2
  • 21
  • 17
  • Hi! Yours seems a nice package. Could you edit the answer adding a line to install `gWidgetsQt`? Thanks – Michele May 19 '13 at 02:04
  • And what about `gWidgetsWWW`? Would be possible to benifit from `cranvas` interactivity in a web app? – Michele May 19 '13 at 02:17
  • 1
    Michele, here is how to install gWidgets2Qt: install `devtools` from cran, then `install_github(c("gWidgets2", "gWidgets2Qt"), "jverzani"))`. Success may vary depending on operating system. As for gWidgetsWWW2, you won't find it able to replicate what `cranvas` can do. There seem to be a number of new packages for using R with various web charting tools (cf. `rCharts`). – jverzani May 22 '13 at 17:43
  • Thanks very much, it compiled successfully. I'm going to ask a question on an error I've been receiving. sure you'll know the answer. – Michele May 22 '13 at 21:51