Publication: A Fast Numerical Algorithm for the Estimation of Diffusion-Model Parameters. A new algorithmic approach for parameter estimation in Ratcliff's diffusion model. … read more

Publication: Sampling The Posterior: An Approach to Non-Gaussian Data Assimilation. A Bayesian approach to data assimilation. … read more

Sarge Release Schedule in view of GR 2004-003. Illustration of the Debian voting system using the result of the General Resolution 2004-004. … read more

publication-quality figures with R, part 2

By , on [atom feed]

Following up on my recent blog entry about generating publication quality figures with R, here are some more hints, this time about setting the figure margins.

An R figure consists of several regions. From the outside in, these are as follows:

[figure regions in R]

figure 1. The different regions of a figure generated in R

These different regions are illustrated in figure 1, above. The figure was created using the following R code:

par(oma=c(2, 2, 2, 2), mar=c(4, 4, 2, 2))

set.seed(1)
plot(rnorm(10), xlab="x label", ylab="y label")

box("outer", col="red", lwd=2)
mtext("device region", side=3, line=1, col="red", outer=TRUE)

box("inner", col="green")
mtext("figure region", side=3, line=1, col="green")

box("plot", col="blue")
text(5, 0, "plot region", col="blue")

A plot for use in a publication will normally need to make efficient use of the available space. For this purpose, the default margins used by R are too generous. This is illustrated in figure 2.

[default plot margins for R plots]

figure 2. A simple R plot, using the default margin settings. The red box was added to show the total area covered by the figure. There are unnecessarily large margins on the top and the right of the figure.

To maximise the area available for displaying information, unnecessary white space around the plot should be avoided. To achieve this, the following suggestions may be useful:

A version of the above plot, with the margins adjusted as shown above, is displayed in figure 3:

[R plot with adjusted margins]

figure 3. The plot from figure 2, but with the margin sizes adjusted to maximise the area available for displaying information. This figure will take up the same amount of space as figure 2 in the enclosing document, but provides much more space for displaying the plot data.

References:

This is an excerpt from Jochen's blog.
Newer entry: 3D graphics in R (updated)
Older entry: Finite Element Discretisation for SPDEs

Copyright © 2012, Jochen Voss. All content on this website (including text, pictures, and any other original works), unless otherwise noted, is licensed under a Creative Commons Attribution-Share Alike 3.0 License.