[R] captions for than one figure

Duncan Murdoch murdoch at stats.uwo.ca
Tue Oct 3 22:25:48 CEST 2000


On Tue, 3 Oct 2000 21:05:50 +0100 (BST), you wrote in message
<200010032005.VAA22378 at achill.nmrc.ucc.ie>:

>Hi,
>
>I would like to have four plots plotted in the one figure and under each plot 
>the caption (a) ... (d). Using mtext I can get so far:
>
>> plot(1:10, exp(1:10), log = "y", xlab = "xlab")
>>  mtext("(a)",side=1,line=4.5)
>> plot(1:10, exp(1:10), log = "y", xlab = "xlab")
>>  mtext("(b)",side=1,line=4.5)
>> plot(1:10, exp(1:10), log = "y", xlab = "xlab")
>>  mtext("(c)",side=1,line=4.5)
>> plot(1:10, exp(1:10), log = "y", xlab = "xlab")
>>  mtext("(d)",side=1,line=4.5)
>
>But the captions in the bottom two plots are clipped. I could textedit the 
>postscipt file and increase the boundary but that seems like overkill to me. Is 
>there any command where I can vertically offset the entire plot.

You want to play with the mar, mai or oma parameters.  See help on
par() for details.

For example, the default is 

> par('mar')
[1] 5.1 4.1 4.1 2.1

and you'd probably get enough space if you tried

par(mar=c(6.1,4.1,4.1,2.1))

The numbers are the margins in "lines" on the four sides of the plots.
You need to execute this before doing the four plots.

For best style (and to crack you up), you could do it like this:

 oldmar _ par(mar=c(6.1,4.1,4.1,2.1))
  do the plots
 par(oldmar)

Duncan Murdoch
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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