Desktop Survival Guide
by Graham Williams
As well as being a package of choice for many Statisticians, R is capable of producing excellent graphics in many formats, including PostScript, PDF, PNG, and JPG.
Example code presented in the following chapters will illustrate the generation of publication quality PDF (portable document format) graphics that can be viewed with many viewers, including Adobe's Acrobat. However, R supports many output formats, including PNG (portable network graphics, supported by many web browsers and importable into many word processors), JPG, and PostScript. Another format supported is XFIG. Such output is editable with the xfig graphics editor, allowing further annotations and modifications to be made to the automatically generated plot. The XFIG graphics can then be converted to an even larger collection of graphics formats, including PDF. For the graphics actually presented here in the book R has been used, in fact, to generate XFIG output which is then converted to PDF. Thus the code examples here, generating PDF directly, may give slightly different layouts to the figures that actually appear here.
A highly interoperable approach is to generate graphs in FIG format which can then be loaded into the xfig application, for example, for further editing. This allows, for example, minor changes to be made to fine tune the graphics, but at the cost of losing the ability to automatically regenerate the plot from the original R code. For LATEX processing the rubber package (under Debian GNU/Linux) will automatically convert them to the appropriate EPS or PDF format. Of course, xfig can also generate PNG and JPG and many other formats.
The basic concept of R's graphics model is that a plot is built up
bit by bit. Each latter component of the plot overlays earlier
components. A plot also has two components. The plotting area is
identified by through the usr parameter, as 4 numbers
, , , and . You can retrieve the current plotting
region (which is defined by the first component of a plot) with:
> plot(rnorm(10)) > par("usr")  0.640000 10.360000 -1.390595 1.153828