User manual

Chapter 11: Other ESS features and tools 58
11.5 Using graphics with ESS
One of the main features of the S package is its ability to generate high-resolution graphics
plots, and ESS provides a number of features for dealing with such plots.
11.5.1 Using ESS with the printer() driver
This is the simplest (and least desirable) method of using graphics within ESS. S’s
printer() device driver produces crude character based plots which can be contained
within the ESS process buffer itself. To start using character graphics, issue the S
command
printer(width=79)
(the width=79 argument prevents Emacs line-wrapping at column 80 on an 80-column
terminal. Use a different value for a terminal with a different number of columns.) Plotting
commands do not generate graphics immediately, but are stored until the show() command
is issued, which displays the current figure.
11.5.2 Using ESS with windowing devices
Of course, the ideal way to use graphics with ESS is to use a windowing system. Under X
Windows, or X11, this requires that the DISPLAY environment variable be appropriately
set.
11.5.3 Java Graphics Device
S+6.1 and newer on Windows contains a java library that supports graphics. Send the
commands:
library(winjava)
java.graph()
to start the graphics driver. This allows you to use ESS for both interaction and graphics
within S-PLUS. (Thanks to Tim Hesterberg for this information.)
11.6 Imenu
Imenu is an Emacs tool for providing mode-specific buffer indexes. In some of the ESS
editing modes (currently SAS and S), support for Imenu is provided. For example, in S
mode buffers, the menubar should display an item called "Imenu-S". Within this menubar
you will then be offered bookmarks to particular parts of your source file (such as the
starting point of each function definition).
Imenu works by searching your buffer for lines that match what ESS thinks is the begin-
ning of a suitable entry, e.g. the beginning of a function definition. To examine the regular
expression that ESS uses, check the value of imenu-generic-expression. This value is set
by various ESS variables such as ess-imenu-S-generic-expression.
11.7 Toolbar
The R and S editing modes have support for a toolbar. This toolbar provides icons to
act as shortcuts for starting new S/R processes, or for evaluating regions of your source
buffers. The toolbar should be present if your emacs can display images. See Appendix A
[Customization], page 82, for ways to change the toolbar.