[R] problem with putting text in outer margins (mtext outer=TRUE)
jim holtman
jholtman at gmail.com
Sat Jul 19 03:38:08 CEST 2008
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?
More information about the R-help
mailing list