Reputation: 18246
I would like to use R to generates some graphs/plots/charts and then use GTK to display them. One feature is that the plot must be able to auto-update and have some interactive features such as set maxima/minima labels, re-scale, allow for normalisation, etc... The data set is potentially of the order of several thousands data points, possibly up to ten of thousands.
Are there any libraries/modules that already do that? My Google-fu was weak. I do not mind either a c++ or a python one.
If there are no such library, how would I be able to achieve this?
Note: The system is kind of embedded -- it certainly has no Internet connection but does have an internal network. Using the web would increase the cost of the system drastically and thus it is not a good solution to my problem.
Upvotes: 1
Views: 921
Reputation: 5700
I wondered whether 10,000 points would be an issue with these graphics devices, and with this gWidgets
script running under RGtk2
and Qt
it was just about the border of fast enough to be acceptable (certainly on my aging machine 100,000 points was way too many):
library(gWidgets)
options(guiToolkit="RGtk2")
w <- gwindow("test")
pg <- gpanedgroup(cont=w)
fl <- glayout(cont=pg)
gg <- ggraphics(cont=pg)
size(gg) <- c(600, 600)
fl[1,1] <- "No. points"
fl[1,2] <- no_pts <- gedit("10", cont=fl, coerce.with=as.numeric)
fl[2,2] <- gbutton("click me", cont=fl, label="", handler=function(h,...) {
n <- svalue(no_pts)
plot(rnorm(n), rnorm(n))
})
If this speed is acceptable, one can make a GUI along the lines of playwith for your specific needs relatively easily. It might be that the cranvas
package can make this faster for Qt.
Otherwise, I don't know if the rgl
package of Duncan Murdoch would be useful, but it might be. Simon Urbanek gave a very nice presentation at the last useR meeting where the openGl graphics engine in some browsers allowed for very fast plots with over 1,000,000 points, and this was done over a websocket.
Upvotes: 2
Reputation: 11454
As you've put python in your tags too, maybe matplotlib would be of some interest? Just in case.
Upvotes: 4
Reputation: 60924
For a web based solution (web is the future :)) that allows this kind of functionality from a server, I would take a look at the shiny package just released by the people at Rstudio. It looks like what you need, without you having to do any programmng. And you get the bonus that anyone with a browser can open it from anywhere. See this lnks:
http://blog.rstudio.org/2012/11/08/introducing-shiny/
Upvotes: 1
Reputation: 17090
First of all, R at its core does not feature interactive plots -- this goes against the idea of controlling almost everything with the programming language itself.
There are some libraries that allow you to create more or less interactive plots, starting from the simplistic locator
function that you would need to wrap into your R programs, and including the manipulate
package from RStudio as well as the iplot
package. There is even a GTK+ based R package called playwith
.
Depending on what you actually want to achieve, maybe using gnuplot would be a better idea.
Upvotes: 2