Skip to content
lawremi edited this page Mar 9, 2012 · 4 revisions

RGtk2 is an interface from R to the GTK+ 2.0 stack. It allows the R programmer to construct a simple to sophisticated graphical user interface (GUI) to statistical functionality implemented in R. RGtk2 is supported on all three major platforms (Linux, Mac, and Windows).

The primary library bound by RGtk2 is GTK+ itself, which provides a complete set of widgets (graphical controls) for constructing a GUI. The available widgets include windows, buttons, drop-down lists, tables, etc. Other libraries bound by RGtk2 include Cairo (vector graphics), Pango (text layout and rendering), and GdkPixbuf (image manipulation).

An RGtk2 GUI may be integrated with other GTK+ GUI's such as that of GGobi via rggobi. The cairoDevice package embeds R graphics into an RGtk2 GUI.

Get RGtk2

The stable version of RGtk2 requires GTK+ version 2.8.0 or higher (and its dependencies). The method of installing GTK+ depends on the operating system (see below). Once GTK+ is installed, it should suffice to enter install.packages("RGtk2") into the R console.

Windows

RGtk2 will automatically download and install the necessary GTK+ binaries upon the first attempt to load the package.

Mac OS X

Download and install the Mac OS X binaries for GTK+. The binaries are kindly provided by Simon Urbanek.

Linux

GTK+ is likely already installed; if not, install the package from the appropriate distribution.

Quick Start

To get started, load the library and then execute a demo. For example:

library(RGtk2)

demo(appWindow)

demo(package="RGtk2") # to see the rest

To draw R graphics inside an RGtk2 GUI:

win = gtkWindow(show = FALSE)

da = gtkDrawingArea()

win$add(da)

asCairoDevice(da)

win$showAll()

plot(1:10)

Obligatory Screenshots

demo(appWindow) on Linux:

Linux screenshot

demo(appWindow) on Windows:

Windows screenshot

Bug Reports

Please report bugs to Michael Lawrence (user michafla at the domain gene.com). Thanks.

Clone this wiki locally