[R] problem with putting text in outer margins (mtext outer=TRUE)

Janet Young jayoung at fhcrc.org
Sat Jul 19 01:00:12 CEST 2008


Hi there,

I'm trying to get some text in the outer margins of my plots and am  
having trouble - the margin text is overlapping my plots, even though  
the outer margin I'm trying to put it in is very big.

I've simplified my problem down to this:

-------------------------

X11(width=7.5,height=10)

par(mfrow=c(6,1),oma=c(20,0,20,0), mar=c(0,3.1,1,2.1))
for (i in 1:6) {
    plot(cars[,"speed"],cars[,"dist"])
}
mtext("Position (Mb)", outer=TRUE, side=1)
mtext("Position (Mb)", outer=TRUE, side=3)

-------------------------

It's an ugly and meaningless set of plots, but you can see my  
problem: the two "Position" strings are right up against the plot,  
the bottom one even overlapping the bottom plot.   Does anyone know  
how I can get the text to appear in the big white space of the outer  
margin, rather than right up against the plot?

thanks in advance,

Janet Young

PS I'm using R 2.7.1  Patched (2008-07-01 r46019) on an i686 linux  
machine.  I have the same problem if I do this on Mac OS X R  2.7.1  
(2008-06-23).



More information about the R-help mailing list