[R] Plotting Text on a graph

Earl F. Glynn efg at stowers-institute.org
Tue Oct 24 17:22:29 CEST 2006


"Dan Chan" <dchan at GFC.STATE.GA.US> wrote in message 
news:43679C69FEEE9C40AC8876C0FF38EF10014FEBD7 at mailsvr01.gfc.state.ga.us...
>
> I plotted 12 graphs on a page and output to a png file.  I wanted to
> have an overall title for all 12 graphs.  What command can I use to do
> this?  Below is the code that plotted the 12 graphs in one page.

Define an "outer margin area" at the top and put your overall title there.

Find some illustrated examples of oma (outer margin area) and mar (margin 
area) here with mfrow/mfcol:
http://research.stowers-institute.org/efg/R/Graphics/Basics/mar-oma/index.htm


Perhaps this will get you started:

# Outer margin area (South, West, North, East).
# Default is all 0s, so ask for North oma of 2.
# Trim some of the space form regular margins (mar) too.

par(mfrow=c(3,4), mar=c(4,4.5,1,1), oma=c(0,0,2,0))

for (i in 1:12)
{
  plot(0)
}

mtext("Overall Title", NORTH<-3, line=0.5, adj=0.5,
      col="red", outer=TRUE, cex=1.2)


efg
Earl F. Glynn
Scientific Programmer
Stowers Institute for Medical Research



More information about the R-help mailing list