[R] Overal plot title after mfrow and .Rhistory questions.

Ross Ihaka ihaka at stat.auckland.ac.nz
Wed Jun 28 22:48:43 CEST 2000

On Wed, Jun 28, 2000 at 08:44:41PM -0700, Adrian Vance Custer wrote:
> Hello everyone,
> I had a few questions that I have not been able to figure out despite a lot of
> reading.
> 1) Adding a title to a multiplot figure:
> If I plot multiple plots with 
> >par(mfrow=c(2,6))
> how do I add an overall title to the figure, not the individual plots?

First, you will need a place to put it -- an "outer" margin.
You can set this up with:

	par(mfrow = c(2, 6), oma = c(0, 0, 2, 0))

This sets up an outer margin with 2 lines of text at the top of the plot.

Now, you do your plots and add the title with

	mtext("Your Overall Title", line = 0.5, outer = TRUE)

This puts the title in the center of the top margin, 0.5 lines out from
the plot.

With large arrays of plots like this you will get lots of blank space
on the page, so you may want to play with shrinking the margins around
the individual plots.  Probably something like:

	par(mfrow = c(2, 6),
	    oma = c(0, 0, 2, 0),
	    mar = c(5.1, 4.1, 2.1, 2.1)

This eliminates at lot of the space at the top of the individual plots.

> 2) Saving histories on the fly:
> 3) Setting the size .Rhistory:

I'll defer to "historians" on these ones.  (I agree that being able to
save the current history in a file would be a good idea).

r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch

More information about the R-help mailing list