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

From: jim holtman <jholtman_at_gmail.com>
Date: Fri, 18 Jul 2008 21:38:08 -0400

try using the 'line' parameter:

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, line=3) mtext("Position (Mb)", outer=TRUE, side=3, line=3)

On Fri, Jul 18, 2008 at 7:00 PM, Janet Young <jayoung_at_fhcrc.org> wrote:
> 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).
>
> ______________________________________________
> R-help_at_r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

-- 
Jim Holtman
Cincinnati, OH
+1 513 646 9390

What is the problem you are trying to solve?

______________________________________________
R-help_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Received on Sat 19 Jul 2008 - 01:42:29 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Sat 19 Jul 2008 - 07:31:36 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive