(This article was first published on

** » R**, and kindly contributed to

R-bloggers)
Last week I have updated the ‘qgraph‘ package to version 1.1.0, available on CRAN now. Besides some internal changes (especially the self-loops have been substantially improved) the most important change is the addition of a GUI interface, which can be called using the argument gui=TRUE. For example:

data(big5)
data(big5groups)
qgraph(cor(big5),groups=big5groups,gui=TRUE)

Will open a plotting window and the GUI that allows the user to set several parameters before plotting:

Graphical User Interface for qgraph

There is also a simplified version of this GUI for regular graphs (not correlation matrices).

What I particularly like about this GUI is that it took me only one day to implement. Making a GUI for qgraph has been on my to do list for a long time, but I never really got to learning how one of the packages that allow this work. When I found out about the ‘rpanel‘ package (which is build on ‘tcltk’) I was pleasantly amazed with how simple and intuitive it was to use.

In short, the way ‘rpanel’ works is by making a ‘panel’ using ‘rp.control()’ which is basically a list and also opens an empty GUI frame. We can use functions such as ‘rp.checkbox’ and ‘rp.slider’ to add elements to the GUI. Using these elements then does two things: an element of the list is changed (e.g., the element ‘xlim’), and a function is called on the list. This way, we can easily make an appropriate GUI element for each argument we need in a plotting function and make buttons that plot, save to PDF, etcetera.

To illustrate this I wrote a small function with comments that uses ‘plot.default’ to plot a scatter plot, and adds a small GUI frame allowing a user to zoom into the scatter plot. The codes can be downloaded here. A small example:

x <- rnorm(100)
y <- x + rnorm(100)
ScatterZoom(x,y)

More information on 'rpanel' can be found in its Journal of Statistical Software article.

*Related*

To

**leave a comment** for the author, please follow the link and comment on his blog:

** » R**.

R-bloggers.com offers

**daily e-mail updates** about

R news and

tutorials on topics such as: visualization (

ggplot2,

Boxplots,

maps,

animation), programming (

RStudio,

Sweave,

LaTeX,

SQL,

Eclipse,

git,

hadoop,

Web Scraping) statistics (

regression,

PCA,

time series,

trading) and more...

If you got this far, why not

__subscribe for updates__ from the site? Choose your flavor:

e-mail,

twitter,

RSS, or

facebook...